12345678910111213141516
use Scalar::Util qw[ looks_like_number ];sub special_compare { my ($x, $y) = @_; if(&looks_like_number($x) and &looks_like_number($y)) { return ($x <=> $y); } else { return (lc $x cmp lc $y); }}my @argA = ('hallo', 3, 'Hallo', "", 22, "das war's" );@argA = sort { special_compare($a, $b) } @argA;print join("\n", @argA);