in reply to Re^3: map vs for\foreach.
in thread map vs for\foreach.

"... 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»

Replies are listed 'Best First'.
Re^5: map vs for\foreach.
by MidLifeXis (Monsignor) on Mar 13, 2015 at 18:27 UTC

    I think, in this case, that we are firmly entrenched in opposite camps, and will just have to agree to disagree. :-)

    --MidLifeXis

      > just have to agree to disagree

      No I disagree, you two won't agree on that.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)

      PS: Je suis Charlie!

      ;-)