![]() |
|
Just another Perl shrine | |
PerlMonks |
Re^3: How to add an exceptio for"for loop"by ELISHEVA (Prior) |
on Mar 21, 2011 at 05:05 UTC ( #894408=note: print w/replies, xml ) | Need Help?? |
I think you may be confusing the command line grep with Perl's grep command. my @selected = grep { $_ ne "." } @some_array selects elements based on whether the content of {....} returns true or false. As { $_ ne "."} is only true on an exact non-match with ".", it will exclude only ".". ".foobar", "foo.bar", etc. will pass the test, i.e. { $_ ne "."} will be true, and therefore will be in @selected.
In Section
Seekers of Perl Wisdom
|
|