I found a variation of this in the Perl Nutshell book:

$ perl -le '
 $foo="fee fie foe foo" ;
 while ($foo =~ m/e/g ) {
   push @bar, pos $foo ;
 }
 print join(":", @bar); '
2:3:7:11

Is there an equivalent way to do the same using map instead of an explicit while loop? I'm guessing not, since map is expecting a list and not a scalar, which $foo is.

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to