>>>>> "SHC" == Shawn H Corey <shawnhco...@gmail.com> writes:

  SHC> Uri Guttman wrote:
  >> that modifies @ARGV so it is a bad idea. also it bypasses grep's purpose
  >> of filtering a list. and as i posted, map is the correct solution

  SHC> map is not the correct solution since it does not filter out those which
  SHC> do not match the pattern.  Only grep can do that.

map will return what is grabbed in $1. if the pattern doesn't match,
nothing is grabbed so it will not return anything for that list element.

perl -le 'print join "-", map /x(\d+)/, qw(x123 y123 x x234)'
123-234

just what the doctor ordered! :)

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to