[svn:perlfaq] r10895 - perlfaq/trunk
[email protected] Sun, 9 Mar 2008 18:29:54 -0700 (PDT)
| Newsgroups | perl.cvs.perlfaq |
|---|---|
| Message-ID | <[email protected]> |
Author: comdog
Date: Sun Mar 9 18:29:52 2008
New Revision: 10895
Modified:
perlfaq/trunk/perlfaq5.pod
Log:
* perlfaq5: How do I change, delete, or insert a line in a file, or append to the beginning of a file?
+ a couple of the print()s were missing the filehandle, which was
the point of the answer.
Modified: perlfaq/trunk/perlfaq5.pod
==============================================================================
--- perlfaq/trunk/perlfaq5.pod (original)
+++ perlfaq/trunk/perlfaq5.pod Sun Mar 9 18:29:52 2008
@@ -95,7 +95,7 @@
open my $in, '<', $file or die "Can't read old file: $!";
open my $out, '>', "$file.new" or die "Can't write new file: $!";
- print "# Add this line to the top\n"; # <--- HERE'S THE MAGIC
+ print $out "# Add this line to the top\n"; # <--- HERE'S THE MAGIC
while( <$in> )
{
@@ -112,7 +112,7 @@
open my $in, '<', $file or die "Can't read old file: $!";
open my $out, '>', "$file.new" or die "Can't write new file: $!";
- print "# Add this line to the top\n";
+ print $out "# Add this line to the top\n";
while( <$in> )
{