• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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