Are you saying that using print instead of printf there would have given a better idea as to what was causing the error? Yea, the problem is resolved now, but your statement has me curious. Always nice to know if something like that will help me in the future... :-)
--Dave
| [reply] |
No, sorry for my ambiguity. Let me be pedantic... The code having a problem was:
printf("%s [ip: $ip] is alive %.2f ms)\n", gethostbyip($host), 1000 * $duration);
Using three seperate printf statements would have shown that $duration and $host were defined, and that gethostbyip($host) returned an undef.
At that point, you could have asked the question Under what circumstances does gethostbyip return an undef?. Your sample code would have also been only four lines long.
I frequently use lots of printfs (or the debugger) to narrow down a question like this.
| [reply] [d/l] [select] |
Oh, ok! Yea, that makes sense. Thanks for the suggestion; I'll remember that next time I'm having strange messages such as that - you're right, debugging something that way would work much better.
--Dave
| [reply] |