1 #!/usr/bin/perl -w 2 use strict; 3 4 $file = "/path/file"; 5 @lines = (); 6 open (<FH>, "< $file") or die "Cannot open $file for read: $!"; 7 while (<FH>) { 8 chomp; 9 push (@lines, $_); 10 } 11 close FH or die "Cannot close $file: $!"; 12 13 print join(',', @lines); # now it works
In reply to Answer: how to populate array with lines from text file? by ybiC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |