it's quite simple

while, for, etc are operators in a way
they do something with whathever you give them

for, for example, assigns every every element of a list to $_
unless you specify differently

so what you're doing with this:

<STDIN>
if (/foo/) { print "found foo" }

is the same as saying:

'some string'
if (/foo/) { print "found foo" }

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


sorry if i'm not speaking totally coherent, it's a bit late here =)
but in short:
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

hth
Jos Boumans



> Maybe the code piece in my mail is misleading. My question is why does the
input from
> STDIN assigned to $_ when given within a loop
> construct and not when given stand alone.
>


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

Reply via email to