#! /usr/bin/perl -w use strict; my $host="wonderwaylabs.com"; my %rec = getips($host); print "$_ --> $rec{$_}\n" for keys %rec; sub getips { my $host = shift; chomp (my $record = `/usr/bin/host $host`); my ($notfound,$matches,%records); $notfound = '\s{1}not\s{1}found\:'; $matches = '^(\S+).*(\d+\.\d+\.\d+\.\d+)$'; if ($record =~ /$notfound/o) { print "No record for $host\n"; #email_resolution_error($host); } else { %records = ( $1 => $2 ) if $record =~ /$matches/o; } return %records; }