• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 151
  • Last Modified:

check for tab in Perl

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
guidway
Asked:
guidway
  • 3
  • 2
  • 2
1 Solution
 
ahoffmannCommented:
if m/\t/
0
 
guidwayAuthor Commented:
Never heard of the m before. thanks. I've always matched with a =~. What's the difference?

guidway
0
 
ahoffmannCommented:
> .. difference?
m/ returns "true" or "false"
=~ modifies the left hand side, usually
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ozoCommented:
$check =~ /\t/
is the same as
$check =~ m/\t/
0
 
guidwayAuthor Commented:
thanks ozo. I figured that out yesterday after he e-mailed me.

guidway
0
 
ozoCommented:
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
 
ahoffmannCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now