in reply to Re: clobbering output
in thread clobbering output

You suggest the use of $., but perlvar cautions with respect to $. that

Because ``<>'' never does an explicit close, line numbers increase across ARGV files (but see examples under eof()).

The OP seems to want to process multiple files from the command line. The relevant example from the entry for eof is:

# reset line numbering on each input file while (<>) { next if /^\s*#/; # skip comments print "$.\t$_"; } continue { close ARGV if eof; # Not eof()! }