Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Limits on a foreach loop

by Crulx (Monk)
on Feb 04, 2000 at 00:34 UTC ( #2803=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://2803]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2022-09-30 22:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (126 votes). Check out past polls.

    Notices?