"... if there are side effects, I did it wrong"
Yes, yes. But you can do what you want: You get the side effect for free - even if you don't want it.
#!/usr/bin/env perl use strict; use warnings; use Data::Dump; my @original_data_set = ( 1 .. 10 ); dd \@original_data_set; my @modified_data_set = map { ++$_ } @original_data_set; dd \@original_data_set, \@modified_data_set; __END__ karls-mac-mini:monks karl$ ./1119774.pl [1 .. 10] ([2 .. 11], [2 .. 11])
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
In reply to Re^4: map vs for\foreach.
by karlgoethebier
in thread map vs for\foreach.
by builat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |