Permalink
Browse files

fixed misleading use of an array to store slurped file content

  • Loading branch information...
1 parent 70f5c47 commit cb99209cf89fbbe83a4aa28a01a28484bd7f8ab5 Martin Becker committed Jun 22, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/perlfaq5.pod
View
@@ -194,11 +194,11 @@ you can fit the whole thing in memory!):
open my $in, '<', $file or die "Can't read old file: $!"
open my $out, '>', "$file.new" or die "Can't write new file: $!";
- my @lines = do { local $/; <$in> }; # slurp!
+ my $content = do { local $/; <$in> }; # slurp!
# do your magic here
- print $out @lines;
+ print $out $content;
Modules such as L<File::Slurp> and L<Tie::File> can help with that
too. If you can, however, avoid reading the entire file at once. Perl

0 comments on commit cb99209

Please sign in to comment.