Re: Argument isn't numeric warning in if statement

2014-09-18 Thread Rob Dixon
On 18/09/2014 00:34, SSC_perl wrote: 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

Re: Argument isn't numeric warning in if statement

2014-09-17 Thread SSC_perl
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

Re: Argument isn't numeric warning in if statement

2014-09-17 Thread Rob Dixon
On 17/09/2014 01:37, SSC_perl wrote: I just ran across something puzzling. Why are these two statements not equivalent when it comes to warnings? if ($item->{'optionprice'}) { $item->{'unitprice'} += $item->{'optionprice'}; } and $item->{'unitprice'} += $item->{'optionprice'}

Re: Argument isn't numeric warning in if statement

2014-09-17 Thread Lawrence Statton
On 09/17/2014 12:46 PM, SSC_perl wrote: > On Sep 16, 2014, at 6:58 PM, > wrote: >> Are you sure you've quoted the code (that's producing the warning) correctly? > > Yes, I did. I double-checked it just to be certain. However, I ran > the code by itself and it doesn't produce that warni

Re: Argument isn't numeric warning in if statement

2014-09-17 Thread SSC_perl
On Sep 16, 2014, at 6:58 PM, wrote: > Are you sure you've quoted the code (that's producing the warning) correctly? Yes, I did. I double-checked it just to be certain. However, I ran the code by itself and it doesn't produce that warning, so it must be something upstream that's caus

Re: Argument isn't numeric warning in if statement

2014-09-16 Thread sisyphus1
-Original Message- From: SSC_perl Sent: Wednesday, September 17, 2014 10:37 AM To: Perl Beginners Subject: Argument isn't numeric warning in if statement I just ran across something puzzling. Why are these two statements not equivalent when it comes to warnings? if (

Argument isn't numeric warning in if statement

2014-09-16 Thread SSC_perl
I just ran across something puzzling. Why are these two statements not equivalent when it comes to warnings? if ($item->{'optionprice'}) { $item->{'unitprice'} += $item->{'optionprice'}; } and $item->{'unitprice'} += $item->{'optionprice'} if ($item->{'optionprice'});