This is the "numerical + alphabetical" version:
sub sort { sort { ($a <=> $b) or ($a cmp $b) } @_ } @a=qw( 1 12 11 102 ddd abc cba 1c 1a ); @a = &sort (@a); print "@a\n"; Output: abc cba ddd 1 1a 1c 11 12 102
In reply to Re: Re: Changing Perl's sort Default
by fglock
in thread Changing Perl's sort Default
by @rocks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |