Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


perl_reading_entire_file_into_a_string

Perl Reading an entire file into a string

Option 1:

Use File::Slurp
$file_contents = read_file($wget_saved_filename);

Option 2:

open (READ_WGET_FILE, "<$data_dir/$wget_saved_filename");
$file_contents = do { local $/; <READ_WGET_FILE> };
close (READ_WGET_FILE);
perl_reading_entire_file_into_a_string.txt · Last modified: 2025/03/20 19:32 by juckins