On Sep 17, 2014, at 3:32 PM, Rob Dixon wrote:
> As you have presented them, those code fragments are identical in meaning.

        That was my understanding as well, but the inline 'if' gave an error 
while the block didn't.  Running the code by itself in TextWrangler does not 
produce the warning.  However, inside of my script, it does.  Strange.

        This probably doesn't have anything to do with it, but I'm logging 
during tests with this code:

BEGIN {
        use CGI::Carp qw(carpout);
        open(my $log, '>>', 'temp_logs/error.log') or warn("Unable to open 
error.log: $! \n");
        carpout($log);
        }

> $item->{unitprice} += $item->{optionprice} if ($item->{optionprice});

        Just so I'm clear on this, am I correct in thinking that Perl evaluates 
an inline 'if' from right to left - meaning that if $item->{optionprice} is NOT 
true, then the addition will not even be seen?  Or does Perl look at the entire 
line before performing it?

Thanks,
Frank

SurfShop shopping cart is now open source...

Follow us on GitHub!
https://github.com/surfshopcart/surfshop


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to