By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,081 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

regex doubt

P: 89
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
Share this Question
Share on Google+
2 Replies


P: 89
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 2.5K+
P: 4,059
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.