Perl: the Markov chain saw | |
PerlMonks |
Re^3: A better (ie.more concise) way to write this?by greengaroo (Hermit) |
on Dec 16, 2013 at 16:13 UTC ( [id://1067351]=note: print w/replies, xml ) | Need Help?? |
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.
-- greengaroo
In Section
Seekers of Perl Wisdom
|
|