Help for this page

Select Code to Download


  1. or download this
    use List::Util 'max'; 
    my @scores = <FH>; 
    my $high_score = max(@scores);
    
  2. or download this
    my @scores = $FH;  # $FH.lines called automatically in list context
    my $high_score= [max] @scores;
    
  3. or download this
    my @feed <== 1, 2, 3, blah blah blah;
    
  4. or download this
    # 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
    
  5. or download this
    my @pipeline <== gather {
       while $whatever
    ...
           }
       }
    my $result = [max] @pipeline;
    
  6. or download this
    sub gen_reduce {
        my $usage = 'Usage: gen_reduce("initial" => $val, "compare" => $co
    +de_ref)';
    ...
        my $compare = $opt{compare};
        my $val = $opt{initial};
        # FINALLY start the actual function
    
  7. or download this
    sub gen_reduce (&compare, ?$initial)
    
  8. or download this
    my $maxstr = gen_reduce { 
       return length($_[0]) > length($_[1]); 
       }
    
  9. or download this
    my $maxstr = gen_reduce { 
       return length($^left) > length($^right); 
       }