A better (ie.more concise) way to write this?by BrowserUk (Pope)
|on Dec 13, 2013 at 15:44 UTC||Need Help??|
BrowserUk has asked for the
wisdom of the Perl Monks concerning the following question:
You have a (compound) variable that you want to increment and then modulate (ie. bound with modulus some number):
Instinct wants ++$a[$_] %= 10 for 0 .. 9; to work. It doesn't.
Of course there is $a[$_] = ++$a[$_] % 10 for 0 .. 9;; which works, but is hardly better, especially when $a[$_] might be more like:
A better way?
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.