[plug] [Perl] sorting arrays based on scalar value - Golf any one?

Matthew Robinson matt at zensunni.org
Mon Nov 18 10:40:58 WST 2002



Carl Gherardi wrote:
> Borrowing from Tony
> 
> Assume perl called with -p option
> 
> perl -p                        03
> sub resort{                    11
> open O,">@_[1]";               16
> print O sort{$b<=>$a}<>        23
> }
>                              -----
>                                53
> 

This doesn't work for me!  Can you explain how I should be calling it to 
get the same results as the previous entries.

Matt

-- 
print map{s&^(.)&\U\1&&&$_}split$,=$",(`$^Xdoc$,-qj`=~m&"(.*)"&)[0].$/



More information about the plug mailing list