in reply to sorting by field of a tab-delimited hash value

Invoking the "Schwartzian Transform" does the magic:

use strict; use warnings; my %students; $students{0354} = "Fred\t3.2"; $students{4873} = "Tom\t2.9"; $students{1522} = "Susan\t4.0"; my @GPASorted = map {$_->[0]} sort { $a->[1] <=> $b->[1] } map {[$_, ($students{$_} =~ /\t(\d*(\.\d*)?)/)[0]]} keys %students; print "$students{$_}\n" for @GPASorted;

Prints:

Tom 2.9 Fred 3.2 Susan 4.0

DWIM is Perl's answer to Gödel