while () { <>; last unless /\S/; print FILE; } #### c:\@Work\Perl>perl -wMstrict -le "while () { $_ = <>; last unless /\S/; print qq{>$_<}; } " qeert >qeert < ghjk >ghjk <