title: Read and Write Operation in perl script
body: <p>I am Newbie to Perl script. </p>
  
  <p>I want to do a read and write operation on a file. I will open a file in read and write mode (+&lt;), and will write into a file. Now, I want read the file whatever I have written to it previously. Below is my code:</p>
  
  <pre><code>#!/usr/bin/perl
  
  `touch file.txt`; #Create a file as opening the file in +&lt; mode
  open (OUTFILE, "+&lt;file.txt") or die "Can't open file : $!";
  
  print OUTFILE "Hello, welcome to File handling operations in perl\n"; #write into the file
  
  $line = &lt;OUTFILE&gt;; #read from the file
  
  print "$line\n"; #display the read contents.
  </code></pre>
  
  <p>When I am displaying the read contents it's showing a blank line. But the file "file.txt" has the data</p>
  
  <pre><code>Hello, welcome to File handling operations in perl
  </code></pre>
  
  <p>Why am I not able to read the contents. Whether my code is wrong or am I missing something.</p>