in reply to File names with interpolated variables

Like this???

print OUT "one: $_" while (<ONE>); print OUT "two: $_" while (<TWO>);

Replies are listed 'Best First'.
Re^2: print out
by Anonymous Monk on Sep 23, 2004 at 20:50 UTC
    i plan on dealing with a 1000 files so not necessary suitable, perhaps a way of using a counter??

      yes:

      my $filename; my $counter; foreach $filename (@filelist) { open(IN, '<', $filename) or do { warn("Error opening $filename."); next; }; $counter++; print OUT ("${counter}: $_") while (<IN>); close(IN); }
        thanks came to a solution
        while (<>) { my $i++; something open (OUT, ">newnames.$i");
      so output files would be named out1 out2 ... out100

        You lost me there. You have multiple input files AND multiple output files? What do you want in which output file?