my @x; sub foo :lvalue { my ($cond, $i) = @_; if ($cond) { return $x[$i]; } else { return $x[0]; } }