Yes, the '.' operator is the concatenation operator.  Another useful related
operator is the .= operator, which automatically adds the right side of the
expression to the end of the left side.

$foo = "Hello ";
$bar = "World!";
$foo .= $bar;
#$foo is now "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 a dot ( . ) right before the $line; in the
foreach command?  does that join the text:  "insert "   to the string:
$line?

----- Original Message -----
From: "Timothy Johnson" <[EMAIL PROTECTED]>
To: "'Jon Molin '" <[EMAIL PROTECTED]>; "'bc '" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, January 24, 2002 11:30 AM
Subject: RE: csv flat file


>
> What I do when I want to do something to each line of a file is break it
up
> into an array with one line per element of the array.  That way I can put
in
> conditions that let me decide which lines I want to do it to.  For
example:
>
> open(INFILE,"infile.csv");
> @infile = <INFILE>;
> close INFILE;
>
> 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 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 thingy...?
>
> perl -pi.bak -e 's/^/insert /' filename
>
> would do it (remove .bak if you don't want a  backup)
>
> /jon
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> --------------------------------------------------------------------------
------
> This email may contain confidential and privileged
> material for the sole use of the intended recipient.
> If you are not the intended recipient, please contact
> the sender and delete all copies.
>


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to