map returns a new list, whereas for allows modification of an existing oneIt sounds like contracdicting although, perhaps, you didn't mean it. The map operator allows modification as well since $_ would be a reference to the corresponding elements of existing array.
$ perl -wle 'my @ar = qw(one two three); print "@ar"; my @new = map { +$_ = uc } @ar; print "@new"; print "@ar"' one two three ONE TWO THREE ONE TWO THREE
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
In reply to Re^2: Perl For loops
by naikonta
in thread Perl For loops
by d2caetano
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |