Greetings monks:
I have the following questions concerning the behaviour of the following code:
I am concerned with the reasons that that they produce the
following output:
#! /usr/bin/perl
for $num(0..42){
foo($num);
sub foo{
print "input to sub=@_\n";
if (@_== 0){
print "test for zero is accurate\n";
}
elsif(@_== 1){
print "test for one is accurate\n";
}
else{
print "Composing mortals with immortal fire. \n";
}
}
}
Produces the following output:
input to sub=0
test for one is accurate
input to sub=1
test for one is accurate
input to sub=2
test for one is accurate
Furthermore , using refs to the sub input as such :
if (\@_ == 0) and if (\@_ ==1)
generates:
input to sub=0
Composing mortals with immortal fire.
this is the same result for the entier range!
Any input on the test and the nature of references
would be greatly appreciated.
Thanks Monks!