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 ( [id://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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-24 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found