Skip to content

Instantly share code, notes, and snippets.

@smls

smls/ip_bench.p6 Secret

Created December 19, 2015 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smls/c51b5d7b328e1fdf8c08 to your computer and use it in GitHub Desktop.
Save smls/c51b5d7b328e1fdf8c08 to your computer and use it in GitHub Desktop.
sub ip-to-number ($ip) {
do given $ip.split('.') {
.[0] +< 24 +
.[1] +< 16 +
.[2] +< 8 +
.[3]
}
}
# ips10k.txt = https://github.com/fsufitch/dailyprogrammer/raw/master/ideas/whois/ips10k.txt
for "ips10k.txt".IO.lines {
my ($start, $end, $name) = .split(' ', 3);
say ip-to-number($start), ip-to-number($end);
}
note now - BEGIN now;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment