This is another job for the Schwartzian Transform. You code is dreadfully inefficient because it does the stripping and case-conversion during every pass through the sort. Try this:
@temp = map {$_->[1]}
sort {$a->[0] cmp $b->[0]}
map {($da = lc $_) =~ s/[\W_]+//g;[$da,$_]}
@temp;
This can be made even more efficient if you know the maximum length of your string. We can use pack to build an intermediary string that we an sort using the low level (in c) default sort. Try this:
@temp = map {(unpack ("A100A100",$_))[1]}
sort
map {($da = lc $_) =~ s/[\W_]+//g;pack("A100A100",$da,$
+_)}
@temp;
Hope this helps
-pete
"I am Jack's utter lack of disbelief"