Re: How can I open and read two files at once in a loop?

2002-10-18 Thread Michael Fowler
I doubt you expected commentary on your code, but hopefully this will be helpful to both you and anyone else reading. On Sat, Oct 19, 2002 at 12:54:18AM +0600, Rakhitha Malinda Karunarathne wrote: You forgot -w and use strict. > $|=1; #*** Set auto Flush This sets autoflush

Re: How can I open and read two files at once in a loop?

2002-10-18 Thread Rakhitha Malinda Karunarathne
L PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, October 18, 2002 9:55 PM Subject: Re: How can I open and read two files at once in a loop? > In my case, both files had an equal number of lines. The both contained > comma-separated values to be imported in

Re: How can I open and read two files at once in a loop?

2002-10-18 Thread shawn_milochik
bcc: 06:49 PM Subject: Re: How can I open and read two files at once

Re: How can I open and read two files at once in a loop?

2002-10-18 Thread Jeff 'japhy' Pinyan
On Oct 17, [EMAIL PROTECTED] said: >while (){ > #assume $otherData would be the $_ from > print FIRSTOUT "$_\n"; > print SECONDOUT "$otherData, $_\n"; > >} Like so: while () { my $otherData = ; print FIRSTOUT $_; print SECONDOUT $otherData, $_; } -- Jeff "japhy" Pi

Re: How can I open and read two files at once in a loop? -- Thanks, and also here's a snippet someone may fine useful...

2002-10-18 Thread John W. Krahn
Shawn Milochik wrote: > > I am working on a project which involves downloading files via FTP from an > AS/400, and I had to write a couple of functions because of the weird way > IBM does things. > > The first function takes a value, and dependent upon the final character, > does something to it.

Re: How can I open and read two files at once in a loop? -- Thanks, and also here's a snippet someone may fine useful...

2002-10-18 Thread shawn_milochik
10/17/2002 bcc: 11:53 AM Subject: Re: How can I open and read two files at once in a

Re: How can I open and read two files at once in a loop?

2002-10-18 Thread John W. Krahn
Michael Fowler wrote: > > You did, but you don't mention what should happen when one of the input > filehandles reaches EOF before the other, or if that's possible. > > The solution I would use would go something like this: > > while (1) { > my $first_in = ; > last unless def

Re: How can I open and read two files at once in a loop?

2002-10-18 Thread Michael Fowler
On Thu, Oct 17, 2002 at 11:27:43AM -0400, [EMAIL PROTECTED] wrote: > I have working code which opens two files (1 read, 1 write), then parses > the text from the file FIRSTIN to a particular format, then prints it to > the FIRSTOUT file. > > I need to add to this the capability to open SECONDIN li

How can I open and read two files at once in a loop?

2002-10-18 Thread shawn_milochik
I want to do something like this: open (FIRSTIN, "<$FIRSTINFile"); open (FIRSTOUT, ">$FIRSTOUTFile"); open (SECONDIN, "<$rtsalFIRSTIN"); open (SECONDOUT, ">$rtsalFIRSTOUT"); while (){ #assume $otherData would be the $_ from print FIRSTOUT "$_\n"; print SECONDOUT "$otherData,

Re: How can I open and read two files at once in a loop?

2002-10-18 Thread Michael Fowler
On Thu, Oct 17, 2002 at 03:49:31PM -0700, John W. Krahn wrote: > Michael Fowler wrote: > > while (1) { > > my $first_in = ; > > last unless defined $first_in; > > > > my $second_in = ; > > last unless defined $second_in; > > > > print FIRSTOUT "$first_i