use List::Util 'max'; my @scores = ; my $high_score = max(@scores); #### my @scores = $FH; # $FH.lines called automatically in list context my $high_score= [max] @scores; #### my @feed <== 1, 2, 3, blah blah blah; #### # bad - do not use my Feed $pipeline .= new (... options to make it do what I said above ...); my $result= &[max] <== @$pipeline; # ??? threaded on both sides ? # blah blah blah $pipeline.add ($item); # every once in a while #### my @pipeline <== gather { while $whatever # code here does its stuff and eventually issues: take $item; } } my $result = [max] @pipeline; #### sub gen_reduce { my $usage = 'Usage: gen_reduce("initial" => $val, "compare" => $code_ref)'; # Hashes need even number of arguments die $usage if @_ % 2; my %opt = @_; # Verify that compare defined and a code reference die $usage if ! defined $opt{compare} || ref $opt{compare} ne 'CODE'; my $compare = $opt{compare}; my $val = $opt{initial}; # FINALLY start the actual function #### sub gen_reduce (&compare, ?$initial) #### my $maxstr = gen_reduce { return length($_[0]) > length($_[1]); } #### my $maxstr = gen_reduce { return length($^left) > length($^right); }