Sorting and undefined values

Matt Lawrence matt.lawrence at virgin.net
Fri Dec 15 15:15:39 GMT 2006


Uri Guttman wrote:
> use Sort::Maker ;
>
> my $sorter = make_sorter(
> 		'ST',
> 		number	=> sub { defined $_->{x} ? $_->{x} : $_->{y} },
> ) ;
>
> my @sorted = $sorter->( @unsorted ) ;
>
> if you use blead perl you could reduce that to $_->{x} // $_->{y}
>
>   
I thought that was going to be the hookhook operator

http://www.perl.com/tchrist/defop/defconfaq.html

Matt



More information about the london.pm mailing list