use Socket; # for AF_INET for my $ip_s ( @ip_strings ) { my $hostname = gethostbyaddr( inet_aton($ip_s), AF_INET ); }