title: Giving both input & output file at command line
body: <p>Si I have this line in the perl script which prints the output to the STDOUT/console</p>
  
  <pre><code>printf "Line no. $i"
  </code></pre>
  
  <p>What code shall I include in the program to direct this output to an output file given by user at the command line itself (as undermentioned)</p>
  
  <p>Right now ,the following portion asks the user for input file:</p>
  
  <pre><code>print "enter file name";
  chomp(my $file=&lt;STDIN&gt;);
  open(DATA,$file) or die "error reading";
  </code></pre>
  
  <p>But I  dont want to ask the user for either of input/output file.
  What I want is a way in which user could give in the input as well as output file from command line while running the program.</p>
  
  <pre><code>perl input_file output_file program.pl
  </code></pre>
  
  <p>What code shall i just include for this.</p>