http://www.perlmonks.org?node_id=79080


in reply to How do i read each line of the file into string?

open (FILE, "<my_file") || die "can't open my_file: $!"; my @stuff = <FILE>; # get whole file into array close(FILE); chomp @stuff; # cut out trailing newlines my $string = join(', ', @stuff); # join to one string undef @stuff; # clean up behind us