> -----Original Message-----
> From: Shawn H Corey [mailto:shawnhco...@gmail.com] 
> Sent: Tuesday, November 17, 2009 11:03
> To: Parag Kalra
> Cc: Perl Beginners
> Subject: Re: Is it necessary to open the file again to read 
> its contents.
> 
> Parag Kalra wrote:
> > Can't this again closing and opening of file avoided while 
> looping through
> > the file?
> 
> See `perldoc -f seek`
> http://perldoc.perl.org/functions/seek.html
> 
        I guess the bigger question is why loop thru the file multiple
times? You should be able to gather all that you need on one pass and
either move into a hash or array depending on what you need. It may be a
small file now, but if you get into the habit when a large file is
needed to be processed and you start doing mulitple reads, then you may
have problems with cpu or io increase. May be a legitimate reason, but I
would learn to get what is needed on one pass and then work with a hash
or array.

         If you have any questions and/or problems, please let me know.
         Thanks.
 
Wags ;)
David R. Wagner
Senior Programmer Analyst
FedEx Freight Systems
1.719.484.2097 Tel
1.719.484.2419 Fax
1.408.623.5963 Cell
http://fedex.com/us 


> 
> -- 
> Just my 0.00000002 million dollars worth,
>   Shawn
> 
> Programming is as much about organization and communication
> as it is about coding.
> 
> I like Perl; it's the only language where you can bless your
> thingy.
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
> 
> 
> 

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to