Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^4: map vs for\foreach.

by karlgoethebier (Abbot)
on Mar 13, 2015 at 18:23 UTC ( [id://1119982]=note: print w/replies, xml ) Need Help??


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!

      ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1119982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found