Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: File Searching

by GrandFather (Saint)
on Sep 13, 2007 at 20:57 UTC ( [id://638907]=note: print w/replies, xml ) Need Help??


in reply to File Searching

You have good solutions for splitting your string, but do you have to normalize your ip string? As a hash key '192.168.0.1' ne '192.168.000.001'. The following may help:

my $ip = '192.168.0.1'; (my $ip_norm = $ip) =~ s/(\d+)/sprintf "%03d", $1/ge; print "$ip | $ip_norm";

Prints:

192.168.0.1 | 192.168.000.001

DWIM is Perl's answer to Gödel

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-19 06:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found