On Sat, Jul 28, 2001 at 01:22:06AM +0200, Jos I. Boumans wrote:
Hopefully my corrections below aren't insulting, but I felt it necessary so
that people don't come away from this discussion with the wrong notions.
> <STDIN>
> if (/foo/) { print "found foo" }
>
> is the same as saying:
>
> 'some string'
> if (/foo/) { print "found foo" }
Except it's not, because a lone <STDIN> also reads from the file, thus
discarding a line.
> this will not assign 'some string' to $_
> actually, perl will thro you a warning like:
> useless use of constant in void context at bla bla line x
No it won't. For one, <STDIN> isn't a constant, two, it doesn't throw a
warning at all. Try it.
> sorry if i'm not speaking totally coherent, it's a bit late here =)
It's true, you aren't speaking totally coherently. :)
> you cant *just* put stuff somewhere and expect it to land in $_
> many operators will take $_ as default operand or input, but a filehandle is
> not an operator
That's true, a filehandle isn't an operator, but <FILE> is.
His expectation that a lone <STDIN> read into $_ is not as nonsensical as
you make it out to be. It's just that a bare filehandle read in a for(;;)
or while loop is a special case, not the rule.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]