Babambar has asked for the wisdom of the Perl Monks concerning the following question:
However this doesn't work. Instead, it erases the whole file. It makes sense that it should wok though, but for some reason it doesn't. Any idea why? thankswhile (<>){ if (/^#!/){ $_ .= "Add this line.\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: To add a string to the content of a file
by GrandFather (Saint) on Nov 27, 2005 at 23:25 UTC | |
|
Re: To add a string to the content of a file
by johnnywang (Priest) on Nov 28, 2005 at 01:01 UTC | |
by sgifford (Prior) on Nov 28, 2005 at 04:36 UTC | |
|
Re: To add a string to the content of a file
by swampyankee (Parson) on Nov 28, 2005 at 01:26 UTC |