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:
snadra
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:
To sort them lexically just use:foreach (sort {$a <=> $b} keys %hash) { # do something with $hash{$_} ... }
Read 'perldoc -f sort' for more information.foreach (sort keys %hash) { # ... }
snadra
|
---|
In Section
Seekers of Perl Wisdom