in reply to Re: Sort Says "not numeric" then sorts numeric anyway?
in thread Sort Says "not numeric" then sorts numeric anyway?

You can simplify your - correctly working - sort a bit to: @x = sort { ($a =~/^(\d+)/)[0] <=> ($b =~/^(\d+)/)[0] } @x;The extra parens together with the access to the first element ([0]) force the regex into list context, which then returns the captured $1.

As an additonal note: Depending on the size of the array, a Schwartzian Transform might be recommended instead.

-- Hofmator