Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Exists in HASH issue

by snadra (Scribe)
on Jul 22, 2003 at 08:17 UTC ( #276653=note: print w/ replies, xml ) Need Help??


in reply to Exists in HASH issue

Hello,

you should read
perldoc perlvar
first, to understand how hashes work. As said before, they are not sorted in any way.
But you can print them out sorted or do something else with them in a sorted way.
This would cause a numerical order:

foreach (sort {$a <=> $b} keys %hash) { # do something with $hash{$_} ... }
To sort them lexically just use:
foreach (sort keys %hash) { # ... }
Read 'perldoc -f sort' for more information.

snadra


Comment on Re: Exists in HASH issue
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2014-07-22 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (126 votes), past polls