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


in reply to Limits on a foreach loop

You need to simply break out of the foreach loop you are in Something like the following would work fine.
$i = 0; foreach $key (sort {$freqpage{$b} <=> $freqpage{$a}} keys %freqpage) { print HOTFILES "$freqpage{$key}\n"; print HOTFILES "$key \n"; if($i++ > 20) { last } }
Good luck.
Crulx crulx@iaxs.net