The stupid question is the question not asked | |
PerlMonks |
Re: Replacing values in an arrayby johngg (Canon) |
on Jan 27, 2013 at 00:05 UTC ( [id://1015552]=note: print w/replies, xml ) | Need Help?? |
A slight variation on toolic's and eyepopslikeamosquito's solutions in that I use a closure to generate the odd numbers (it returns the next odd number every time it is called) and I wrap the logic for finding duplicates in a do block to avoid leaving the %seen hash lying around after it is no longer needed.
I hope this is of interest. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|