467,179 Members | 1,245 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,179 developers. It's quick & easy.

regex doubt

Hi,
I am just a beginner exploring perl and sorry if this is a silly question.
I open a file and split by tab and check for the 11th column string as below:

I am checking whether a string contains a word chr inside a if loop as below:

Expand|Select|Wrap|Line Numbers
  1. if (($v[10] =~ m/chr/i)) {
  2.  
  3. //execute
  4. }
How to check if no chr is present in the string now. It is completely a reversed one. Thanks.
Oct 21 '08 #1
  • viewed: 1074
Share:
2 Replies
Sorry for the jiffy question. I could figure out the way. Thanks.
Expand|Select|Wrap|Line Numbers
  1. if (($v[10] !~ m/chr/i)) { 
  2.  
  3. //execute 
Oct 21 '08 #2
KevinADC
Expert 2GB
There is no need for the double set of parentheses:
Expand|Select|Wrap|Line Numbers
  1. if (($v[10] !~ m/chr/i)) { 
should be:

Expand|Select|Wrap|Line Numbers
  1. if ($v[10] !~ m/chr/i) { 
Oct 21 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Jim Hefferon | last post: by
4 posts views Thread by Er Galv?o Abbott | last post: by
14 posts views Thread by jumpstart | last post: by
8 posts views Thread by Johnny | last post: by
3 posts views Thread by Beeeeeves | last post: by
8 posts views Thread by jlowery@blarg.net | last post: by
15 posts views Thread by Kay Schluehr | last post: by
8 posts views Thread by james_027 | last post: by
2 posts views Thread by John B | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.