⭐ in reply to How do I read an entire file into a string?
But if you are working with large files (or a large number of them) you might consider using File::Slurp, which, in my case, decreased the runtime of my script from 40-45 minutes to 3 minutes.{ local $/ = undef; open FILE, "myfile" or die "Couldn't open file: $!"; binmode FILE; $string = <FILE>; close FILE; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Answer: How do I read an entire file into a string?
by Grygonos (Chaplain) on Aug 18, 2004 at 14:28 UTC | |
by bmann (Priest) on Aug 18, 2004 at 20:17 UTC |