Solved

check for tab in Perl

Posted on 2002-06-24
7
139 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
execute pl/sql block from perl program 3 119
Input from stdin for perl 6 118
perl CPAN issue 3 99
PERL - Find newest folder 12 118
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

867 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

24 Experts available now in Live!

Get 1:1 Help Now