my $TRUE = 1; my $FALSE = 0; [...] my $EofFlag = $FALSE; while(!$EofFlag) { [...] my $cmtseq_cnt = read(perlIN,$cmtseq,5); if ($cmtseq_cnt < 5) { $EofFlag = $TRUE; # Redundant, given what we do next, but here for example last; } }