Hi, 

flotsan <[EMAIL PROTECTED]> asked:
> I am reading the Perl Camel book - Programming Perl 3rd Ed 
> and having a bit of trouble to understand some of the ideas 
> presented in section 2.11.2. 
> Specifically it is told the following two statements are different:
> 
> 1) if ($_ = <STDIN>) { print; }                # suboptimal: 
> doesn't test 
> defined
> 2) if (defined($_ = <STDIN>)) { print; }   # best
> 
> But as I see it, these two do the same thing in that in the 

Just run these two snippets and input "0" and you'll see the
difference - snippet 1 will not print a zero because like an
undefined value, it evaluates to false in boolean context.

HTH,
Thomas

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to