Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: Balancing Coding Time And Code Quality

by Coruscate (Sexton)
on Dec 04, 2003 at 19:50 UTC ( #312293=note: print w/replies, xml ) Need Help??


in reply to Re: Re^2: Balancing Coding Time And Code Quality
in thread Balancing Coding Time And Code Quality

Aha, I didn't realize that $_ was an alias within a map (greps as well then). Which makes a lot of sense if you take even half a second to think about it. I even threw together an example to prove it to myself.

# because $_ is an alias, @foo is also modified my @foo = qw/one two three four five six/; my @bar = map { s/[aeiou]//g; $_ } @foo; print join(', ', @foo), $/; # because we localize $_, @foo is not modified my @foo = qw/one two three four five six/; my @bar = map { local $_ = $_; s/[aeiou]//g; $_ } @foo; print join(', ', @foo), $/; # not to mention even when you loop through an array my @foo = qw/one two three four five six/; s/[aeiou]//g for @foo; print join(', ', @foo), $/;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://312293]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2018-02-20 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (268 votes). Check out past polls.

    Notices?