|
|
| Keep It Simple, Stupid | |
| PerlMonks |
Re: simultaneously adding and multiplying numbers in a hash/ arrayby AnomalousMonk (Prior) |
| on Aug 09, 2010 at 22:12 UTC ( #853926=note: print w/ replies, xml ) | Need Help?? |
|
The use of a hash in this application is positively dangerous unless the elements of the @change array (which become the keys of the hash) can be guaranteed to be unique. E.g.:
Update: The algorithm can be expressed more concisely with some list-processing functions:
I think it could be expressed yet more concisely in Perl 6, but my 6-fu is not that great. Would it be something like:
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||