Created
January 15, 2014 15:17
-
-
Save ericleasemorgan/8438082 to your computer and use it in GitHub Desktop.
Perl subroutine to slurp up the contents of a text file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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