in reply to Simple hash problem
my $counter = $x; foreach my $key (sort keys %user_hash) { last if --$counter < 0; .. rest of loop .. } [download]
-- Randal L. Schwartz, Perl hacker