in reply to Re: splitting array values
in thread splitting array values

The code that creates the array is this:
while( ($key, $value) = each %rank ) { $rank = $rank . " " . $key; }
Also when I print print $score[0]; it still gives me all the contents of the array. Thanks

Replies are listed 'Best First'.
Re (2): splitting array values
by VSarkiss (Monsignor) on May 20, 2004 at 02:10 UTC

    It looks like your making one long string in $rank, the equivalent of:$rank .= " " . $key; I'm guessing that your array has one element with one long string in it, so it looks like it's not sorted.

    If you just want to get a sorted list of the keys, you can do:

    @sorted = sort { $b <=> $a } keys %rank;
    Notice you don't have to do a reverse, you can just change the sense of the comparison.

      I tried sorting the keys like you said VSarkiss, but it still doesn't change the order when I sort them, or when I reverse them either.

      thanks