http://qs321.pair.com?node_id=817807


in reply to Re: Why is "for" much slower than "while"?
in thread Why is "for" much slower than "while"?

Try
whyfor2 => sub { seek( $IN1, 0, 0 ); my %counts = (); ++$counts{$_} for ( ; defined( $_ = <$IN1> ) ; ) ; die unless keys %counts == @list; },