return values evaluating to true

2006-01-25 Thread radhika
Hi, I have a snippet of code as below. Even when I return 0 or '', why does @blocks evaluate to true? If rows returned are 0, then if(@blocks) should evaluate to false, correct? Thanks, Radhika --- use strict; use diagnostics; my @blocks = (); sub do_something { my @row = @_;

Re: return values evaluating to true

2006-01-25 Thread Chas Owens
On 1/25/06, radhika [EMAIL PROTECTED] wrote: Hi, I have a snippet of code as below. Even when I return 0 or '', why does @blocks evaluate to true? If rows returned are 0, then if(@blocks) should evaluate to false, correct? Thanks, Radhika --- use strict; use diagnostics; my @blocks = ();

Re: return values evaluating to true

2006-01-25 Thread Bob Showalter
radhika wrote: Hi, I have a snippet of code as below. Even when I return 0 or '', why does @blocks evaluate to true? If rows returned are 0, then if(@blocks) should evaluate to false, correct? ... sub do_something { my @row = @_; return @row if(@row); return ''; } @blocks