Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@iskernel
Last active December 20, 2015 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iskernel/6049224 to your computer and use it in GitHub Desktop.
Save iskernel/6049224 to your computer and use it in GitHub Desktop.
How to read an entire file into a string using Perl.
use File::Slurp;
#Reads an entire file into a string (scalar)
my $text = read_file( 'index.html' ) ;
#Writes a string (scalar) into a file
write_file( 'index_2.html', $text ) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment