in reply to perl sorting
The "simple" way to sort @array numerically is to use a Schwartzian Transform:
@array = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_ => get_num($_)] } @array; sub get_num { my $string = shift; my ($num) = $string =~ /(\d+)/; return $num; }
As for the hash, hashes are inherently unsorted, so what you need to do depends upon what you want to do.
Update:: ColonelPanic's solution is simpler if you can guarantee that the numbers always start in the same position in the string.
Cheers,
Ovid
New address of my CGI Course.
|
|---|