in reply to Or condition in Perl
You've got:
if($array[$i] =~ /$ .pst/)
This will never match anything. The "$" matches the end of the string. So what you're trying to match is the end of the string, followed by five characters. Clearly you can't have characters after the end of the string!
What you want is:
if($array[$i] =~ /\.(pst|prj)$/)
This matches a literal full stop character, then either "pst" or "prj", and then the end of the string.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Or condition in Perl
by rajkrishna89 (Acolyte) on Mar 11, 2012 at 09:22 UTC | |
by Corion (Patriarch) on Mar 11, 2012 at 09:53 UTC |