title: Perl: Couldn't open a file with file name as input
body: <p>I am trying to copy lines of a file to another file.I want to give filenames for both input and output file. I tried to do without asking for any input parameters and it worked fine but with filename as input it failed.Here is my code:</p>
  
  <pre><code>use strict;
  use warnings;
  
  #names of file to be input and output 
  my $inputfile = &lt;STDIN&gt;;
  my $outputfile = &lt;STDIN&gt;;
  
  open(INPUT,'&lt;', $inputfile) 
  or die "Could not open file '$inputfile' $!";
  
  open(OUTPUT, '&gt;', $outputfile) 
  or die "Could not open file '$outputfile' $!";
  
  while (&lt;INPUT&gt;) {
    print OUTPUT;
  }
  
  close INPUT;
  close OUTPUT;
  print "done\n";
  </code></pre>