title: Perl: adding input filename to output filename
body: <p>I wrote a script that reads each file in a directory, does something and outputs results from each input file to two different files, e.g. "outfile1.txt" and "outfile2.txt". I want to be able to link my resulting files to original ones, so how can I add input filename (infile.txt) to the resulting filenames, to get something like this:</p>
  
  <p>infile1_outfile1.txt, infile1_outfile2.txt</p>
  
  <p>infile2_outfile1.txt, infile2_outfile2.txt</p>
  
  <p>infile3_outfile1.txt, infile3_outfile2.txt ...?</p>
  
  <p>Thanks for any help!</p>