in reply to Why do Perlers hate C-style for-loops, especially when they're called for?
in thread 'each' syntax oddity?

Why do some people speak Perl with a C accent? {grin} A more native Perl solution:
my @copy = @array; while (my ($first, $second) = splice @copy, 0, 2) { # do stuff }
Your code has many potential "off by one" locations. Yes, it's possible to get it exactly right, but much safer to let Perl deal with the edges than for me to keep computing the edges. Call it defensive programming.

-- Randal L. Schwartz, Perl hacker

  • Comment on •Re: Why do Perlers hate C-style for-loops, especially when they're called for?
  • Download Code