Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Closest-value-in-list Golf!

by larryk (Friar)
on May 29, 2001 at 17:47 UTC ( #83923=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub g {blah}
    
    ...
    print "Closest value is ",$list[g(\@list,$number)];
    # or
    print "Closest value is ",$list[g($number,\@list)];
    
  2. or download this
    #!perl -w
    use strict;
    ...
    1.2
    1.3
    17.5
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2015-07-29 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls