On Mon, 06 Oct 2003 14:20:05 -0400, Chris Charley wrote:
> Then, on the command line I type: perl prepend.pl somefile.txt, but
> somefile.txt does not have the changes(Line: ).
Try writing 'perl prepend.pl somefile.txt > newfile.txt' instead.
--
Tore Aursand <[EMAIL PROTECTED]>
--
To unsubsc
Hi,
Chris Charley <[EMAIL PROTECTED]> wrote:
> Should be (works correctly):
>
> while (<>) {
>s/^/Line: $. /;
>print;
> }
>
> Then the command could be:perl prepend.pl somefile.txt >
> somefile.new
> which would correctly print to the 'new' file the
> somefile.txt file wi
Chris Charley wrote:
> "Chris Charley" <[EMAIL PROTECTED]> wrote in message news:...
> [snip]
> > while (<>) {
> > s/^/Line: $. /;
> > }
>
> Should be (works correctly):
>
> while (<>) {
>s/^/Line: $. /;
You don't need a regular expression to do this. This should suffice
$_ = "Line
You're reading in the file, but not changing it. You're only changing it in
memory. Check out the responses to the other post called "make changes to a
file, then reading in those changes"
-Original Message-
From: Chris Charley [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 1
"Chris Charley" <[EMAIL PROTECTED]> wrote in message news:...
[snip]
> while (<>) {
> s/^/Line: $. /;
> }
Should be (works correctly):
while (<>) {
s/^/Line: $. /;
print;
}
Then the command could be:perl prepend.pl somefile.txt > somefile.new
which would correctly prin