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
ay, October 06, 2003 11:20 AM
To: [EMAIL PROTECTED]
Subject: Add text to beginning every line
Hi
Hope someone can help with this. I used to be able to do it, but now have
forgotten. I want to prepend some text to every line in a file. The program
below:
#!/usr/bin/perl
# prepend.pl - adds line nu
"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
Hi
Hope someone can help with this. I used to be able to do it, but now have
forgotten. I want to prepend some text to every line in a file. The program
below:
#!/usr/bin/perl
# prepend.pl - adds line number to beginning of every line in a file
use strict;
use warnings;
while (<>) {
s/^/Li