Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


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);
reading_entire_file_into_a_string.txt · Last modified: 2018/05/22 16:24 by juckins