doubling a number seems simpler than doing the modulo, thus:
# change even-numberd list entries to 'hi' foreach $i (0..@list/2) { $double = $i * 2; $list[$double] = 'hi'; }
of course you could do away with the extra variable "$double". loose the variable, insert another line of comment to explain what happens. same difference.
-- Brigitte 'I never met a chocolate I didnt like' Jellinek http://www.horus.com/~bjelli/ http://perlwelt.horus.at
In reply to Re: What would you do?
by bjelli
in thread What would you do?
by MeowChow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |