Re: Sorted Hash




Quoth "palexvs@xxxxxxxxx" <palexvs@xxxxxxxxx>:
I filled hash and then printed it (sorted by key):
my %hs = (
key10 => 5,
key5 => b,
aey9 => 7,
)
foreach my $k (sort keys %hs) { print "$k $hs{$k}\n"; }

key - string ([0-9A-F]{72}), 50K records.
How do it more effective?

Tie::IxHash, or maintain an array of keys yourself. See perldoc -q
sorted.

Ben

.



Relevant Pages

  • Re: Printing Array of Hashes
    ... > I would like to know how to check the values of the keys in the hash. ... I was only using an array of hashes because you used that in your code. ... perldoc perldata ...
    (perl.beginners)
  • Re: Remove an element from middle of array
    ... So each time through we are only looking at the keys we haven't already ... I could likely assign directly to the hash rather than first assigning to ... array and then using the array to assign to hash. ... perldoc perlmodinstall ...
    (perl.beginners)
  • Re: comparing some but not all fields in lists
    ... and what's in common." ... I should compare only 3 of the 82 fields in each list. ... comparing all 82 fields as a single array element. ... cannot handle multiple keys as you want it to. ...
    (perl.beginners)
  • Re: Build an array from a text file
    ... Now that I have created my array, ... The dictionary object has a 'keys' method that returns a 0 based array ... Dim vArray As Variant ... dictionaries, so any help would be great! ...
    (microsoft.public.word.vba.general)
  • Re: style of functions with complex arguments
    ... > where the list at the end is actually a set of 3 triples. ... triples I would use an array reference as well. ... then you need to check that the 'weights' is an array ref (perldoc -f ...
    (perl.beginners)