in reply to Timing out a traceroute

I understand that you have pretty much already solved your own problem - but just as an alternative, have you considered using Net::Traceroute?

Timeouts would be taken care of for you, and your code could be significantly simplified. Here is a short example script to illustrate, that does basically the same as your get_traceroute sub.

#!/usr/bin/perl -wl use strict; use Net::Traceroute; my $host = shift; my $trace = get_trace($host,3,30); print $trace->{_text_accumulator} and exit; sub get_trace { my ($host, $query_timeout, $timeout) = @_; my $trace = Net::Traceroute->new( host => $host, query_timeout => $query_timeout, timeout => $timeout, ); return $trace; }

Hope this helps,
Darren :)