Solved

check for tab in Perl

Posted on 2002-06-24
7
138 Views
Last Modified: 2010-03-05
What would be proper syntax to check for a tab in a string of characters using perl? Would I use ($check being my string):

if ($check =~ /\t/)


or

if ($check =~ /'\t')

or how would I do this?

Thanks,

guidway
0
Comment
Question by:guidway
  • 3
  • 2
  • 2
7 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 7105190
if m/\t/
0
 
LVL 12

Author Comment

by:guidway
ID: 7105199
Never heard of the m before. thanks. I've always matched with a =~. What's the difference?

guidway
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7105244
> .. difference?
m/ returns "true" or "false"
=~ modifies the left hand side, usually
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 84

Expert Comment

by:ozo
ID: 7106700
$check =~ /\t/
is the same as
$check =~ m/\t/
0
 
LVL 12

Author Comment

by:guidway
ID: 7107362
thanks ozo. I figured that out yesterday after he e-mailed me.

guidway
0
 
LVL 84

Expert Comment

by:ozo
ID: 7109735
m/ can return a list, not just "true" or "false"
=~ m// does not modify the left hand side,
=~ s/// or =~ tr/// may modify the left hand side
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7109990
just to clarify:
  with "true" and "false" i didn't mean the exact boolean values, but perl's opinion about it (which might be a list too:)
  and ozo is right about the =~ vs. m/ , both are equal
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now