in reply to Best structure for range find?
# assume line is: # ip;ip;ip;.. datum # my %ip_hash; while ( my $line = <FILE> ) { my ( $ip, $datum ) = split /\s*/, $line; my @ip = split /\;/, $ip; foreach my $ipa ( @ip ) { $ip_hash{ $ipa } = $datum; } } # Later.. if ( exists $ip_hash{ $query_ip } ) { do_something_with_datum( $ip_hash{ $query_ip } ); } else { do_not_found_action( $query_ip ); }
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important
|
|---|