in reply to Re^2: To Debug a Hanging Perl Script
in thread To Debug a Hanging Perl Script

Anywhere. Presumably near the top so it gets executed soon. And it's:
$| = 1; # Auto-flush STDOUT