Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^3: modify list through grepby calin (Deacon) |
on Nov 26, 2006 at 16:46 UTC ( [id://586126]=note: print w/replies, xml ) | Need Help?? |
Yes, you're right. My reply was a bit tongue-in-cheek - the OP asked why his grep aliasing example "didn't work" and I resolved to beat it into submission ;) There's a slight difference though. *m = \@l; aliases the entire array object. The sub {\@_} trick creates a new array object containing scalar elements which are aliased to memberes in @l matching /a/ (in OP's example it contains only one element aliased to the first element in @l - "a").
In Section
Seekers of Perl Wisdom
|
|