in reply to Empty STDIN does not exit while loop

Another way would be to use eof.

... while ( not eof( STDIN ) ) { chomp( my $line = <> ); ... } ...

I hope this is of interest.

Update: Ignore this, I misread the question :-}

Cheers,

JohnGG