while () { next unless /XXXX/; $. += 1; ### obviously this does not work ... print $_ ; } #### while () { next unless /XXXX/; print ; }