On Mon, Aug 07, 2000 at 12:16:22AM -0400, Michael Mathews wrote:
> Here's a thought. Wouldn't this be cool (see below)? The idea is that in 
> Perl 6 you should be able to read from a file handle one character or one
> line at a time (just like you can in Perl 5) BUT if you just go ahead and
> use the filehandle, directly, in a scalar context then perl will read it in
> as a string most efficiently, and allow you to perform your rgex, or
> whatever without creating a temporary variable just to hold the contents of
> that file.

Cute. This more or less the way SNOBOL handled I/O.
For input, this wouldn't be too hard: just overload the stringification
of the input object (we're going to have objects, yes?) with the
readline operation.
But for symmetry, you would want to do output as well, by just assigning
values to the file object. This seems harder to me.

I would settle for $fh->readline provided it would be at least as
efficient as <$fh>.

-- Johan

Reply via email to