in reply to Sort problems
($a =~ /(\d+)/)[0] <=> ($b =~ /(\d+)/)[0] || ($a =~ /(\w+)/)[0] cmp ($b =~ /(\w+)/)[0]
Do you actually understand what you write here?
You are sorting first on the first number (correct) and then lexicographically on the whole string (\w+ matches all of your input data entirely).
What you need to do is to write down the rules by which to sort. First in plain English, and then translate them into a program.
When you do a regex match, put a print "$1\n" statement after that to verify that it matched what you think it did.
|
|---|