in reply to modify list through grep
grep returns aliases, but assignment (to @m) makes copies. You can not modify the grep results directly though, so you need to do something like take a reference, pass it to a (naughty) sub, or make a modifiable alias in order to modify the alias, and not just a copy thereof:
@l = ( "a", "b", "c" ); $_ = "z" for grep /a/, @l; print @l;
Prints "zbc".
print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!
|
|---|