AFAICT,
It looks like the part you want changed is the last three lines of perl, kinda like so:
while(<STDIN>) {
chomp;
if (/^Received:[^\[]+\[(\d+)\.(\d+)\.(\d+)\.(\d+)\]/) {
$n=`host $4.$3.$2.$1.$ARGV[0] 2>&1`;
exit(0) if ($n=~/$ARGV[1]/m);
}
}
exit(1);
Well, the best i could come up with looks something like this:
while(<STDIN>){$_="host ".join'.',map{s/(\d+)/$1/}split
/./."$ARGV[0] 2>&1";`$_`=~/$ARGV[1]/m&&exit 0}exit 1
(or if we spread that out for readability):
while (<STDIN>) {
$_= "host " .
join '.', map {s/(\d+)/$1/} split /./ .
"$ARGV[0] 2>&1";
`$_` =~ /$ARGV[1]/m && exit 0
}
exit 1
Which reduces it one line. It has not been tested well at all (but should have the same functionality), and could probably be reduced more. Does this help at all?
jynx