Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


perl_reading_entire_file_into_a_string

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
perl_reading_entire_file_into_a_string [2025/03/20 19:31] – removed - external edit (Unknown date) 127.0.0.1perl_reading_entire_file_into_a_string [2025/03/20 19:32] (current) juckins
Line 1: Line 1:
 +==== Perl Reading an entire file into a string ====
 +Option 1:
  
 +<code>
 +Use File::Slurp
 +$file_contents = read_file($wget_saved_filename);
 +</code>
 +
 +Option 2:
 +
 +<code>
 +open (READ_WGET_FILE, "<$data_dir/$wget_saved_filename");
 +$file_contents = do { local $/; <READ_WGET_FILE> };
 +close (READ_WGET_FILE);
 +</code>