Skip to content

Instantly share code, notes, and snippets.

@ericleasemorgan
Created January 15, 2014 15:17
Show Gist options
  • Save ericleasemorgan/8438082 to your computer and use it in GitHub Desktop.
Save ericleasemorgan/8438082 to your computer and use it in GitHub Desktop.
Perl subroutine to slurp up the contents of a text file
sub slurp {
my $f = shift;
open ( F, $f ) or die "Can't open $f: $!\n";
my $r = do { local $/; <F> };
close F;
return $r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment