perlquestion
Russ
<em>This post was moved from [id://1843]<br>
Please do not vote for this node. It will affect the wrong user.<br>
Thank you -- [Q&AEditors]</em>
<p>
I wish to populate an array from a text file.
Each line of text should be a list item.
<p>
Here's what I've come up with, but results in "Use of uninitialized value at line 11" error.
What am I missing?
<code>
1 #!/usr/bin/perl -w
2 use strict;
3
4 $file = "/path/file";
5 open (<FH>, "< $file") or die "Can't open $file for read: $!";
6 while (<FH>) {
7 push (@lines, $line);
8 }
9 close FH or die "Cannot close $file: $!";
10
11 print join(',', @lines); # see if it worked
</code>