while($nodie) { while() { if(! print $_,"\r") { confess "can't print to socket: $!"; $nodie = 0; last; } } }