On Tue, Nov 18, 2008 at 09:53, Lauri Nikkinen <[EMAIL PROTECTED]> wrote:
snip
> #Read the data into an array
> my @data = <$fh>;
snip

This will only work so long as the file can be fit into memory, and
even then, if the file is large enough, it can have a noticeable
impact on system performance.  If you are not one hundred percent
certain that the file will stay small (relative to the amount of
memory you have) then it is better to seek back to the start of the
file:

while (<$fh>) {
}

seek $fh, 0, 0;

while (<$fh>) {
}

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to