1 #!/usr/bin/perl -w 2 use strict; 3 4 $file = "/path/file"; 5 @lines = (); 6 open (, "< $file") or die "Cannot open $file for read: $!"; 7 while () { 8 chomp; 9 push (@lines, $_); 10 } 11 close FH or die "Cannot close $file: $!"; 12 13 print join(',', @lines); # now it works