Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Perl::Critic says don't modify $_ in list functions and other things

by ikegami (Patriarch)
on Jul 09, 2020 at 03:03 UTC ( [id://11119060]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @a = qw( a b c );
    my @b = map { $_ = uc($_); $_ } @a;
    say "@a";  # A B C     <-- You clobbered @a!!!
    say "@b";  # A B C
    
  2. or download this
    my @a = qw( a b c );
    my @b = apply { $_ = uc($_);} @a;
    say "@a";  # a b c
    say "@b";  # A B C
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-19 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found