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

Re: How can I access object data in a user defined sort cmp function?

by LanX (Saint)
on Jan 28, 2015 at 17:12 UTC ( [id://1114788]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %h    = %{$self->{hash_ref}};
    my @keys = sort { $h{$a} <=> $h{$b} } keys %h;
    
  2. or download this
      DB<100> $self={
               hash_ref=>{item1=>'value1',item2=>'value2'}
    ...
    
      DB<103> @keys=sort {$h{$a}<=>$h{$b}} keys %h;
     => ("item1", "item2")
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 21:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found