my $f = "/etc/fstab"; open ( my $fh, "<", $f ); while ( <$fh> ) { print if (1..3) ; } #### my $f = "/etc/fstab"; open ( my $fh, "<", $f ); while ( <$fh> ) { chomp; print "$_\n"; } print "=" x 78, "\n\n"; print "after 1st while loop\n"; seek( $fh, 0, 0); while ( <$fh> ) { print if (1..3) ; }