Server name/IP converter
#!/usr/bin/perl -w use strict; use Socket; my $arg = shift; if ($arg =~ /^(\d+\.){3}\d+$/) { print scalar gethostbyaddr(inet_aton($arg), AF_INET), "\n" } else { printf "%vd\n", scalar gethostbyname $arg }
DZone Snippets > Minimiscience > internet
12363 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
#!/usr/bin/perl -w use strict; use Socket; my $arg = shift; if ($arg =~ /^(\d+\.){3}\d+$/) { print scalar gethostbyaddr(inet_aton($arg), AF_INET), "\n" } else { printf "%vd\n", scalar gethostbyname $arg }