Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: A better (ie.more concise) way to write this?

by greengaroo (Hermit)
on Dec 16, 2013 at 16:13 UTC ( #1067351=note: print w/ replies, xml ) Need Help??


in reply to Re^2: A better (ie.more concise) way to write this?
in thread A better (ie.more concise) way to write this?

Why not this:

for ( @a ) { ++$_; $_ %= 10 }

And if you really want to process only the first 10, you can still use the slice:

for ( @a[0..9] ) { ++$_; $_ %= 10 }


A for will get you from A to Z; a while will get you everywhere.


Comment on Re^3: A better (ie.more concise) way to write this?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2015-07-05 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls