Skip to content

Instantly share code, notes, and snippets.

@digizeph
Last active December 16, 2015 23:29
Show Gist options
  • Save digizeph/5513982 to your computer and use it in GitHub Desktop.
Save digizeph/5513982 to your computer and use it in GitHub Desktop.
This is a perl script that helps you retrive your public IP address. This is useful if your terminal is located in a private network with NAT to access internet.
#!/usr/bin/perl
use LWP::Simple;
my @lines=split("\n",get("http://myip.dk"));
foreach my $line (@lines)
{
if($line =~ />([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)</)
{
print "found : $1\nin line $line\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment