http://www.perlmonks.org?node_id=286640


in reply to Reading from a file

Hi itzMe,

If you want to be able to access the contents of the file again after initially reading it, slurp it into an array. This is as simple as

open FILE, "sample.txt" or die $!; my @lines = <file1>;

Now you can use @lines in whatever way you want.

Hope this helps

thinker