use strict; my $c = 0; while(<>) { chomp; $c++; my $a; print "1: $a iteration $c\n" if $a; $a = $_; print "2: $a iteration $c\n" if $a; }