in reply to Re: File to @array then parse like a file
in thread File to @array then parse like a file
In dbrock's example. It certainly does seem like a waste to slurp the file. The point is not to slurp the file for premature optimization unless there is a valid reason to do so.
Cheers - L~R
UPDATE: If the file is extremely large, but you only need the top part of it, you can use last to end the loop once you have all the data that you need. I am guessing that this may be the reason for wanting to speed things up.
UPDATE 2: Setting $/ = \65536; does in deed change how much of the file is read by buffer. The other factor that slows things down by iterating by newlines is the stuff in between (data munging). It has to be performed more times than if you are working with a larger data block. Thanks to chromatic for keeping me on my toes and runrig for clearing up some confusion in the CB.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: File to @array then parse like a file
by chromatic (Archbishop) on Mar 15, 2003 at 00:02 UTC |