For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2007 > RE: Trying to read two files using a sub to get the data, but 2nd









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: Trying to read two files using a sub to get the data, but 2nd
Wagner, David --- Senior Programmer Analyst --- WG

2007-01-23, 7:04 pm

It is two different files. Sub1 and sub2 read from 1 file for 10
rcds and then closes the files and goes on to the next sub? If I have
two different filehandles pointing at two different files, why would I
have to do a s? I am just trying to read two text files at the same
time and determine if key fields are equal or not. If not, then
determine the lower of the two, add the numeric field, read the next rcd
from this file and go back to top of the loop again and start the
compare process over.


If you have any problems or questions, please let me know.

Thanks.

Wags ;)
David R Wagner
Senior Programmer Analyst
FedEx Freight
1.408.323.4225x2224 TEL
1.408.323.4449 FAX
http://fedex.com/us=20

-----Original Message-----
From: tom.phoenix@gmail.com [mailto:tom.phoenix@gmail.com] On Behalf Of
Tom Phoenix
Sent: Tuesday, January 23, 2007 12:03
To: Wagner, David --- Senior Programmer Analyst --- WGO
Cc: Beginner Perl
Subject: Re: Trying to read two files using a sub to get the data, but
2nd read on the 2nd file goes to EOF

On 1/23/07, Wagner, David --- Senior Programmer Analyst --- WGO
<David.Wagner@freight.fedex.com> wrote:

> I am just trying to read text files which are delimited by a
> regular end of line. I usually only read one file at a time, but

thought
> it should not be that big a thing to have two file handles open and

pass
> the filehandle to the sub.
>
> Can I not ready two different text files at the same time

using
> two different filehandles?


What you describe should be possible.

How are you relocating the file position to the correct place in the
file, when you wish to re-read the data after the first time? Does the
subroutine use s(), or is it the caller's responsibility?

--Tom Phoenix
Stonehenge Perl Training

****************************************
******************************
This message contains information that is confidential and proprietary to F=
edEx Freight or its affiliates. It is intended only for the recipient name=
d and for the express purpose(s) described therein. Any other use is proh=
ibited.
****************************************
******************************

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com