Closures are compiled too. That is, whether you use gt or > (or whatever) is decided at compile time - there is no runtime dynamic there.
@list = qw/123 3.14 foo bar 42/; $q = <>; chomp $q; $test = ($q eq "num") ? sub{ $a <=> $b } : sub{ $a cmp $b }; $\="\n"; print join ",", sort $test @list;
In reply to Re^6: How A Technique Becomes Over-rated
by Anonymous Monk
in thread How A Function Becomes Higher Order
by Limbic~Region
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |