Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


reading_entire_file_into_a_string

This is an old revision of the document!


Perl - Reading an entire file into a string

Option 1:

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

Option 2:

# put contents of the file we saved into a variable
open (READ_WGET_FILE, "<$data_dir/$wget_saved_filename");
$file_contents = do { local $/; <READ_WGET_FILE> };
reading_entire_file_into_a_string.1491425009.txt.gz · Last modified: 2017/04/05 16:43 by juckins