Solved

check for tab in Perl

Posted on 2002-06-24
7
140 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
use perl to insert into MySQL database 9 137
Perl count the hash for print 4 165
Perl, group, sort, count question 6 133
ppm conversion to curl on a module install 8 82
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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