creeble has asked for the wisdom of the Perl Monks concerning the following question:
I know there's a good reason having to do with the definition of grep, but I mean *really*.use constant REGEXP => qr(string); @list = ('astring', 'notstriing'); $s = 'bstring'; print $s =~ REGEXP; # true print grep {REGEXP} @list; # prints whole list. print grep {/string/} @list; # prints correct match.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: grep {CONSTANT} @list
by tobyink (Canon) on Nov 21, 2012 at 20:08 UTC | |
|
Re: grep {CONSTANT} @list
by LanX (Saint) on Nov 21, 2012 at 20:42 UTC | |
|
Re: grep {CONSTANT} @list
by afoken (Chancellor) on Nov 21, 2012 at 19:05 UTC | |
by creeble (Sexton) on Nov 21, 2012 at 19:11 UTC | |
by frozenwithjoy (Priest) on Nov 21, 2012 at 19:21 UTC | |
by Anonymous Monk on Nov 21, 2012 at 19:24 UTC | |
|
Re: grep {CONSTANT} @list
by frozenwithjoy (Priest) on Nov 21, 2012 at 19:52 UTC |