Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Reg Ex to find IP address in range

by gjb (Vicar)
on Aug 28, 2003 at 16:34 UTC ( [id://287438]=note: print w/replies, xml ) Need Help??


in reply to Reg Ex to find IP address in range

First of, I assume your IP address is actually valid and in the format you mention in your post.

Now for your problem: why make life hard? The code below is quite simple:

my @bytes = split(/\./, $ip); if ($bytes[2] <= 55 && $bytes[3] <= 55) { # ok }

You may -- or even should -- want to look at Net::IP, especially at the bincomp function.

Hope this helps, -gjb-

Log In?
Username:
Password:

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

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

    No recent polls found