sub by_priority { for (qw(Organization Service FAQ)){ $a=~/^$_/?return -1: $b=~/^$_/?return 1:1 } return $a cmp $b; }
fglock beat me to it. But same, idea different way to do it, and I think the same amount of strokes.
-enlil
In reply to Re: [perlre/perlgolf] Golf this: return -1 or return +1 on regexp subroutine please
by Enlil
in thread [perlre/perlgolf] Golf this: return -1 or return +1 on regexp subroutine please
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |