title: Read a text file and store each line in a variable using perl
body: <p>I have a text file (sample.txt) with some data. I want to read the text file and store each line in an array or a variable.</p>
  
  <p>sample.txt</p>
  
  <pre><code>ab1234
  str:abcd
  pq4567
  </code></pre>
  
  <p>How can i store each of these lines in an array or a variable using perl script.</p>