in reply to Sorting text-number values

Is there a better solution than this?

It depends, are the values in the set unique if converted to upper case and are the numbers always less than say 10 digits ?

Update - assuming answers are yes try

#!perl use strict; my %out=(); while (<DATA>){ chomp; my $key = uc $_; $key =~ s/(\d+)/sprintf("%010d",$1)/eg; $out{$key} = $_; } print "$out{$_} ($_)\n" for (sort keys %out); __DATA__ blank_5_str_1 blank_5_str_10 blank_5_str_11 blank_5_str_12 blank_5_str_13 blank_5_str_14 blank_5_str_2 blank_5_str_3 blank_5_str_4 blank_5_str_5 blank_5_str_6 blank_5_str_7 blank_5_str_8 blank_5_str_9
poj