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 = (); > sub do_something > { > my @row = @_; > return @row if(@row); > return ''; > } > @blocks = do_something(); > if([EMAIL PROTECTED]) > { > print("Got this number: @blocks\n"); > } > else > { > print("Got nothing\n"); > } snip
The second return in do_something() is your problem. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>