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;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|