I've already seen many examples, so I shall not touch on foreach.
The Map function could do the work too assuming memory is not a problem.
However I am not too sure if I got the following short cut correct :-
open FILE, 'data.txt' or die "$!\n";
print (map "InsertYourText $_",);
close FILE;
Tha
Hello World!"
But in this case you needed the string at the beginning of the line.
-Original Message-
From: bc [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 24, 2002 10:56 AM
To: Timothy Johnson; 'Jon Molin '
Subject: Re: csv flat file
ah, i see your point, and is that
good point.
-Original Message-
From: Russ Foster
To: [EMAIL PROTECTED]
Sent: 1/24/02 8:37 AM
Subject: RE: csv flat file
Depending on the size of the file, you may not want to read the whole
thing
into memory first.
So...
open(OUTFILE,">outfile.csv") ;
open(INFILE,&
Depending on the size of the file, you may not want to read the whole thing
into memory first.
So...
open(OUTFILE,">outfile.csv") ;
open(INFILE,"mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 24, 2002 10:30 AM
To: 'Jon Molin '; 'bc '
Cc: [EMAIL PROTECT
;
foreach $line(@infile){
$line = "insert ".$line;
}
open(OUTFILE,">infile.csv");
print OUTFILE @infile;
-Original Message-
From: Jon Molin
To: bc
Cc: [EMAIL PROTECTED]
Sent: 1/24/02 5:44 AM
Subject: Re: csv flat file
bc wrote:
>
> hello
>
> i
bc wrote:
>
> hello
>
> i have a flat file (csv) [it has about 114 rows]
>
> i want to put the word "insert " in front of each row,
>
> how it the "for each" writtin? in other words, in perl, how do i do a for each row
>insert the word "insert ", then it comes out of the "for each" loop thin