My question is how can I get it to have semantics exactly like sort?Do you mean so both of the following examples would work?
my @A = mysort { lc $a cmp lc $b } @list; my @B = mysort @list;
I don't think you can, as the mandatory arguments must occur before the optional.
Also note that sort is missing from the list of examples in perlsub. grep is listed, but grep's code block is mandatory.
In reply to Re: How to get sort-like semantics?
by FunkyMonk
in thread How to get sort-like semantics?
by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |