in reply to Re: sorting an array with mixed elements...
in thread sorting an array with mixed elements...

To use the method proposed by Cris...
print "Sorted table...\n\n"; { no warnings 'numeric'; print sort { $a <=> $b } @table; }
...when each element starts with an alphabetic character, and an alphabetic sort is desired (targeting each element's initial alpha character) this would,presumably, then become:
print "Sorted table...\n\n"; { # no warnings 'numeric'; print sort { $a cmp $b } @table; }
Is a "no warnings" statement also warranted?

Thanks!

Replies are listed 'Best First'.
Re^3: sorting an array with mixed elements...
by blazar (Canon) on Jun 10, 2007 at 21:27 UTC
    print sort { $a cmp $b } @table;

    That is the default and you'd better not specify it at all.

    Is a "no warnings" statement also warranted?

    No except perhaps if any element of @table is undef and you want it to be and perl not to complain. Do you?

      blazar wrote:

      "That is the default and you'd better not specify it at all."

      Thanks, for that information!