Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Limits on a foreach loop

by Crulx (Monk)
on Feb 04, 2000 at 00:34 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-28 11:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found