Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How do I sort a Hash of Hashes?

by neuroball (Pilgrim)
on Jan 10, 2004 at 02:34 UTC ( [id://320279]=note: print w/replies, xml ) Need Help??


in reply to How do I sort a Hash of Hashes?

You have to rewrite the code so, that it sorts using the string comparitor (cmp) and you have to dereference the Hash of Hashes with an arrow operator.

sort { $products{$a}->{"name"} cmp $products{$b}->{"name"} }

Replies are listed 'Best First'.
Re: Answer: How do I sort a Hash of Hashes?
by ysth (Canon) on Jan 11, 2004 at 07:27 UTC
    You have to rewrite the code so, that it sorts using the string comparitor (cmp) and you have to dereference the Hash of Hashes with an arrow operator.
    The extra arrow isn't needed anymore. This changed sometime at or before 5.6.1.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 05:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found