[Pdx-pm] anonymous (?) regex use
Michael Rasmussen
mikeraz at patch.com
Wed Jan 12 12:04:44 PST 2005
I'm trying to build a regex on the fly and then search an array:
#!/usr/bin/perl -Tw
@group = qw ( foo bar baz fuz mlr );
$regex = "/fu/";
@found = grep {$regex} @group;
foreach (@found) {
print "$_\n";
}
but this populates @found with all members of @group.
When I change the grep line to:
@found = grep {/fu/} @group;
then @found is populated with one element, fuz.
Cluestick anyone?
--
Michael Rasmussen, Portland Oregon
Be appropriate && Follow your curiosity
http://meme.patch.com/memes/BicycleRiding
Get Fixed: http://www.dampfixie.org
The fortune cookie says:
Is it NOUVELLE CUISINE when 3 olives are struggling with a scallop in a
plate of SAUCE MORNAY?
More information about the Pdx-pm-list
mailing list