adjohan has asked for the wisdom of the Perl Monks concerning the following question:
I'm not sure why it still print "return hoo". &$rhoo must evaluate to true... and I don't understand why?$rboo = sub{($a,$b)=boo()}; $rzoo = sub{($a,$b)=zoo()}; $rhoo = sub{($a,$b)=hoo()}; print "return boo ", &$rboo, "\n" if (&$rboo); print "return zoo ", &$rzoo, "\n" if (&$rzoo); print "return hoo ", &$rhoo, "\n" if (&$rhoo); sub boo { return (1, 'bar'); } sub zoo { return (1, undef); } sub hoo { return 0; }
Thanks,
Adrianus
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Returning array
by Joost (Canon) on Feb 26, 2005 at 18:15 UTC | |
|
Re: Returning array
by gaal (Parson) on Feb 26, 2005 at 18:14 UTC |