How to read from text file using perl

Perl is one of the most powerful easy to use scripting language. It provides developers with lot of features and functionality.
Here is the code snippet to read from a text file using perl and store each row in an array:


......
......
@data;
......
open(FH,"test.txt");
while()
{
push(@data,$_);
}
.....
.....

Hope you find this information useful and easy to use. Please leave your suggestions or feedback in the comments section below.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">