From: "Michael G Schwern" <[EMAIL PROTECTED]>
To: "Nathan Wiger" <[EMAIL PROTECTED]>
Sent: Friday, May 04, 2001 9:46 PM
> On Fri, May 04, 2001 at 04:42:07PM -0700, Nathan Wiger wrote:
> > I'm wondering what this will do?
> > $thingy = $STDIN;
> > This seems to have two possibilities:
> > 1. Make a copy of $STDIN
> > 2. Read a line from $STDIN
>
> While perhaps inconsistent, I'd really rather it did #2. Here's the
> basic argument... compare how often you dup a filehandle with how
> often you read from one. Duping is swamped by several orders of
> magnitude. Dup with $fh = $STDIN.copy; (or whatever). $line =
> $STDIN.next should still work normally.
Here's what I'd like (in general interators):
1) Using in a scalar context gets the next value. $line = $STDIN;
2a) Using in a unknown-length list context gets all the values. @lines =
$STDIN;
2b) Using in a known-length list context gets enough values. ($line1,
$line2) = $STDIN;
3) Using on the LHS of a = outputs a value (or a bunch of values if RHS is a
list).
4) Using on the RHS of a := copies. $STDOUT := $STDERR;
5) Using with a $() operator won't get. if ($($STDOUT) eq $($STDIN)) {foo}.
(?)
That is, getting without somthing special gets values out of the iterator,
getting
with a := gets the iterator itself (: for inner), and $() derefs it to a
filenameish thing (?).
This leaves <> free, and I think the use of := agrees with what is planned.
It also avoids the use of a verbose .next (and the dot, which I still don't
like <G>).
-=- James Mastros