--- Michael Fowler <[EMAIL PROTECTED]> wrote:
> On Thu, Aug 02, 2001 at 09:20:43AM -0700, Paul wrote:
> > print <IN>;
> >
> > If IN is accessing a large file, does the second syntax try to
> > slurp the whole thing into memory before printing it? Or is there
> > some internal optimization that doles it through in bufferloads?
>
> AFAIK, print <IN> is not special-cased to read chunk by chunk. In
> fact, it's more ineffecient than simply slurping the entire file in
> and then printing it. The syntax is equivalent to:
>
> print join($", <IN>);
but wait a sec, print() is a list context, so <IN> should return all
the lines of the file as elements of a list, which print() should
receive as seperate args. I assume that means they're all hanging in
memory until printed, but why is that like the abovementioned join(),
which would catenate them into a single scalar first?
I can see how a scalar file-slurp & print would be more efficient,
though, since print() will output the lines as seperate args here.
As I said, though, this is only for verification that the whole list is
in memory. Thanks. =o)
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]