Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

How A Function Becomes Higher Order

by Limbic~Region (Chancellor)
on Sep 16, 2005 at 15:51 UTC ( #492651=perltutorial: print w/ replies, xml ) Need Help??

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 $high_score;
    while ( <FH> ) {
        chomp;
        $high_score = $_ if ! defined $high_score || $_ > $high_score;
    }
    
  3. or download this
    sub gen_max {
        # Create an initial default value (or undef)
    ...
    
    # Get the return value of the anonymous sub
    my $high_score = $max->();
    
  4. or download this
    sub gen_reduce {
        my $usage = 'Usage: gen_reduce("initial" => $val, "compare" => $co
    +de_ref)';
    ...
        $maxstr->($_);
    }
    my $long_str = $maxstr->();
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://492651]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-09-21 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (175 votes), past polls