B
Bart Van der Donck
Hello,
Suppose this code:
# ---------------------------
$a=2;
print "variable a has now value '$a'.\n";
&addone($a);
print "variable a has now value '$a'.\n";
sub addone
{
$b=shift;
$b++;
return $b;
}
# ---------------------------
gives as result:
variable a has now value '2'.
variable a has now value '2'.
Is it possible to have $a at value '3' after executing the sub ?
I tried with 'return', 'shift' and so, but couldn't find a way so that
$a would directly be affected by what happens in sub &addone (without
variable $a is mentionned in sub &addone obviously).
Thanks for tips or hints
Bart
Suppose this code:
# ---------------------------
$a=2;
print "variable a has now value '$a'.\n";
&addone($a);
print "variable a has now value '$a'.\n";
sub addone
{
$b=shift;
$b++;
return $b;
}
# ---------------------------
gives as result:
variable a has now value '2'.
variable a has now value '2'.
Is it possible to have $a at value '3' after executing the sub ?
I tried with 'return', 'shift' and so, but couldn't find a way so that
$a would directly be affected by what happens in sub &addone (without
variable $a is mentionned in sub &addone obviously).
Thanks for tips or hints
Bart