http://qs1969.pair.com?node_id=45868

Russ has asked for the wisdom of the Perl Monks concerning the following question:

This post was moved from Categorized Questions and Answers
Please do not vote for this node. It will affect the wrong user.
Thank you -- Q&AEditors

I wish to populate an array from a text file.   Each line of text should be a list item.

Here's what I've come up with, but results in "Use of uninitialized value at line 11" error.   What am I missing?

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