Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

(tye)Re2: Why Closures?

by tye (Sage)
on Apr 26, 2001 at 21:45 UTC ( #75837=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @twice= map $doubler->($_), @list;
    my @thrice= map $tripler->($_), @list;
    
  2. or download this
    my @twice= map 2*$_, @list;
    my @thrice= map 3*$_, @list;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://75837]
help
Chatterbox?
[Eily]: if so, most subs start with my (VARIABLES) = @_ anyway
[moritz]: for short subs, I sometimes let them work on $_[0] directly
[Eily]: moritz but that should be fine unless you modify them
[choroba]: if you modify them, Perl will crash with "Modification of a read-only value attempted" for $1
[choroba]: I can't replicate the situation, but I remember it was very hard to debug

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














    Results (296 votes). Check out past polls.

    Notices?