- or download this
sub is_private {
my ($packed_ip) = @_;
...
)
}x;
}
- or download this
use strict;
use warnings;
...
print("got: $result\n");
print("expect: ", "0110"x3, "\n");
- or download this
got: 011001100110
expect: 011001100110
- 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";
}
- 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
}
- or download this
use Inline CPP => <<'__EOI__';
...
}
__EOI__