"John W. Krahn" schreef:
> Dr.Ruud:
>> Mathew Snyder:
>>> John W. Krahn:
>>>> Yes, Perl has five "false" values: undef, (), 0, '' and '0', and
>>>> two of those are valid input from the readline operator.
>>>
>>> Should running the above from the command line make a difference? I
>>> ran them both entering 0 each time and I got 0 back. This is what
>>> it looks like:
>>>
>>> [EMAIL PROTECTED]:~> perl -e 'if ($_ = <STDIN>) { print; }'
>>> 0 <---input value
>>> 0 <---returned value
>>
>> Normally, $/ is "\n", so there is often a newline character at the
>> end of the value of $_.
>
> The reason that there is a newline character at the end of the input
> is because that is the way the terminal software works, not because
> of the value of $/.
<STDIN> isn't limited to "the terminal software".
echo -n test | perl -le 'print "<$_>" while <STDIN>'
echo -n test abc | perl -le '$/=" "; print "<$_>" while <STDIN>'
If "the terminal software" is active, does every keyboard action append
a newline to the input that becomes printed?
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>