in reply to Double for loops.

Depending on exactly what it is you want...

for my $outer ( qr/hi/, qr/bye/ ) { print grep { /$outer/ } qw/ bike hello hi / }

or

my $outer = join "|", qw/ hi bye /; print grep { /$outer/ } qw/ bike hello hi /;

or, if you want to know which pattern matched

$outer = join "|", qw/ hi bye /; /($outer)/ and print $1 for qw/ bike hello-hi hi-ho /;

Replies are listed 'Best First'.
Re^2: Double for loops.
by amoss (Initiate) on Jul 19, 2007 at 19:04 UTC
    I do need to know what pattern is matched, it that way more efficient than nesting two foreach loops?

      Efficiency means different things to different people in different circumstances. If you mean "is it faster", then Benchmark them.