in reply to Sort and Substitution

hi! rather than telling you how you could complete your task in a better way, here is why your substitution doesn't work: the search pattern (substr($ordered[$x],3,3)) is not evaluated as an expression, only $ordered[$x] gets evaluated to its value. so you are trying to substitute a string like "(substr(1243234123411224,3,3))" that $ordered[$x] doesn't contain. to illustrate what happens:
my $foo = "12342343432424232"; my $bar = "substr12342343432424232,3,3"; $foo =~ s/(substr($foo,3,3))/fnord/; $bar =~ s/(substr($foo,3,3))/fnord/; print "foo: $foo\n"; print "bar: $bar\n";

the code above prints:
foo: 12342343432424232 bar: fnord
yt, snowcrash