Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Approximate Matching Key

by kilinrax (Deacon)
on Apr 06, 2001 at 22:21 UTC ( #70550=note: print w/replies, xml ) Need Help??


in reply to Approximate Matching Key

How about this?
#!/usr/bin/perl -w use strict; my %data = ( 1 => 'foo', 3 => 'bar', 7 => 'baz', 12 => 'fumble' ); print &find_nearest (10, \%data); sub find_nearest($\%) { my $target = shift; my %data = %{shift()}; while (!defined $data{$target}) { $target--; } return $target; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2022-01-24 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (65 votes). Check out past polls.

    Notices?