my $File_Data = get_file_data('/path/to/the/file/to/read'); print $File_Data; sub get_file_data { my $titlefile = shift; open F, "< $titlefile" or die "Couldn't open `$titlefile': $!"; local $/ = undef; # Read entire file at once my $contents = ; # Return file as one single `line' close F; return $contents; }