my $fileContents; open (FILE, $txt_file) || die "Could not open $txt_file - $!\n"; while () { $fileContents .= $_; } close (FILE);