in reply to Putting file contents into a scalar
NOTE: Make sure that slurping the file into a scalar is really what you want to do. Obviously there's no problem if the file is small(ish). You might run into memory issues if you try slurping large files into memory. Perhaps you could give us some indication on what you plan on doing with the scalar. We could offer some advice as to whether that's the best way to go...my $fileContents; open (FILE, $txt_file) || die "Could not open $txt_file - $!\n"; while (<FILE>) { $fileContents .= $_; } close (FILE);
|
|---|