# a lvalue subroutine can be assigned to # so, one could roll one's own vec, for example. # following is only a simple demo, though $a; $b; sub test : lvalue { my $cond = shift; $cond ? $a : $b; # assign to a or b } sub printthem { $a = "undef" unless $a; $b = "undef" unless $b; print "a is $a and b is $b\n"; } # lvalue subroutine test(0) = 1; # assign to $b printthem(); $a = $b = undef; test(1) = 1; # assign to $a printthem();