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

Re^3: sorting string

by davido (Cardinal)
on Aug 28, 2005 at 16:29 UTC ( [id://487275]=note: print w/replies, xml ) Need Help??


in reply to Re^2: sorting string
in thread sorting string

Yes, after posting my response it hit me that your question simply didn't ask what you wanted answered.

Zaxo has it right; you probably want a hash with key/value relationship. Then you ultimately want the strings stored as keys, and the computed values as values associated with the keys. ...something like this:

use strict; use warnings; my %strings; # Set up some example key/value relationships. Your method # for populating the hash will be more complex, but isn't # defined in the question. $strings{"Here is one string"} = 233; $strings{"Here is another string"} = 151; $strings{"Here is yet another"} = 322; print map{ "$_ = $strings{$_}\n" } sort{ $strings{$b} <=> $strings{$a} } keys %strings;

Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-26 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found