#!/usr/bin/perl -T use strict; use warnings; $|=1; # int2ipaddr.pl - convert integers from stdin to IPv4 addresses on stdout use Socket; while (defined (my $line=<>) ) { chomp $line; next if $line !~ m{ \A \d+ \Z }xms; next if $line < 0; next if $line > 4294967295; my $ipaddr = inet_ntoa( pack('N',$line) ); print "$ipaddr\n"; }