Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Regexp: Private IP Addresses

by ikegami (Pope)
on Aug 25, 2009 at 19:25 UTC ( #791164=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub is_private {
        my ($packed_ip) = @_;
    ...
            )
        }x;
    }
    
  2. or download this
    use strict;
    use warnings;
    ...
    
    print("got:    $result\n");
    print("expect: ", "0110"x3, "\n");
    
  3. or download this
    got:    011001100110
    expect: 011001100110
    
  4. or download this
    sub is_private {
        my ($packed_ip) = @_;
    ...
            || ($packed_ip & "\xFF\xF0\x00\x00") eq "\xAC\x10\x00\x00"
            || ($packed_ip & "\xFF\xFF\x00\x00") eq "\xC0\xA8\x00\x00";
    }
    
  5. or download this
    sub is_private {
        my $nummy_ip = unpack('N', shift);
    ...
            || ($nummy_ip & 0xFFF00000) == 0xAC100000   # 172.16.0.0/12
            || ($nummy_ip & 0xFFFF0000) == 0xC0A80000;  # 192.168.0.0/16
    }
    
  6. or download this
    use Inline CPP => <<'__EOI__';
    
    ...
        }
    
    __EOI__
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://791164]
help
Chatterbox?
[Discipulus]: [OT] if i have an svg image (a map of italian provinces) like this one in which way i need to interact with it to have a geochart?
[Corion]: I haven't found a good way to plot stuff into country maps... Maybe one of the demos of D3.js has something usable?
[Discipulus]: i need to use css to get and colorize various different IDs?
[Corion]: I haven't used it, but http://datamaps. github.io/ looks promising
[Discipulus]: thanks.. a more perlish solution?

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2017-03-23 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (285 votes). Check out past polls.