my $string; # Open the file open(FILE, "$file_name") or die "could not open $file_name : $!"; # Iterate over each line of the file while (<FILE>) { # Take off trailing newline chomp; # Append line and comma to the string $string .= "$_,"; } # Close the file close(FILE); # Chop off trailing comma chop $string;
In reply to Re: How do i read each line of the file into string?
by koolade
in thread How do i read each line of the file into string?
by anjaana78
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |