On Thu, Aug 02, 2001 at 11:55:35AM -0700, Paul wrote:
> 
> --- Michael Fowler <[EMAIL PROTECTED]> wrote:
> > 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,

print() does impose a list context, and <IN> does evaluate to all of the
lines of the file as elements of a list.  join also imposes a list context,
and <IN> would evaluate in the same manner.


> which print() should receive as seperate args.

It does.


> I assume that means they're all hanging in memory until printed,

They are, but they do so until they're joined, at which point a really big
line hangs around in memory.


> but why is that like the abovementioned join(), which would catenate them
> into a single scalar first?

You can only print a string.  When print is given multiple arguments it
joins them with $" before printing.  This is documented in perldoc -f print.

 
Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to