[Israel.pm] boolean statment as sub parameter

ik idokan at gmail.com
Sun Feb 22 10:36:39 PST 2009


I've created a sub like this:

sub demo {
  my $paramA = shift;
  my $paramB = shift;
  my $paramC = shift;

when I used the sub like so:

demo($var1, ($id >= 1) and data_exists(...), "18");

the sub does not have any parameters that exists at @_ (if I print it
using print Dumper(@_) prior on using shift, however when I use it
like so:

my $bool =  ($id >= 1) and data_exists(...);
demo($var1, $bool, "18");

the parameters passes properly.

Am I missing here something or doing it wrong or what is going on ?
I'm using perl v5.10.0 under Debian Linux (x86_64).


More information about the Perl mailing list