Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: getting the highest value in a simpler way

by tmoertel (Chaplain)
on Nov 10, 2004 at 16:21 UTC ( #406707=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
        sub make_max_finder {
            my $max;
  2. or download this
        my $max_finder = make_max_finder();
  3. or download this
        print $max_finder->();    # 0
        print $max_finder->(-1);  # 0
        print $max_finder->(2);   # 2
  4. or download this
        print $max_finder->(-1, 3, 0);  # 3
        print $max_finder->(-1, 0, 1);  # 3
  5. or download this
        my $max_finder = make_max_finder();
        $max_finder->();  # retrieve maximum
  6. or download this
        my $max_value = make_max_finder()->(@values);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://406707]
Discipulus is Corion reading 'Gory details of parsing quoted constructs'?..
[perldigious]: That's awesome erix. One of my work friends, who coincidentally convinced me to learn Perl originally, has a Finnish pen-pal. I showed him this and he immediately wanted to send it along to her.
[perldigious]: Also coincidentally, I'm currently in the middle of a winter storm that has dropped 1 foot of snow and is expected to drop another. I might have to adapt this for customers/vendors who come visit and put it at the beggining of every presentation I give.
[Discipulus]: the photo was removed... Cyrano de Berjerac was not of the same idea..

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (13)
As of 2016-12-06 16:24 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (112 votes). Check out past polls.