Hi Giorgio,
I think what you want exists. Sleep has an is predicate i.e. $a is $b to see if $a and $b reference the same thing.
I've thought about adding the ability to reference and dereference arbitrary scalar containers. I ultimately decided against it. Some values (primitives and strings) are passed effectively by value and others (objects, hashes, arrays, and functions) are passed by reference. If you want the ability to modify something after passing it between multiple scopes I recommend encapsulating it in a hash or array. Then you can update a value in the container and have it affect the other vars referencing that same container.
That said, the pass by reference/value stuff happens on assignment and with literals. If you pass an argument to a function, the scalar container is always passed directly to the function so you can do stuff like:
sub foo
{
$1 = "foo";
}
$x = "bar";
foo($x);
# $x is now foo
Keep in mind this applies to subroutines declared in Sleep. Most functions try to avoid side effects like this by making copies of the scalar (using the semantics for pass by value or reference described above). Fork is one of them. The Sleep 2.1 Manual HTML version notes any side effects in all the internal functions. So you can become aware of this if you need to.
So in short... if you want side effects consider using a hash or an array as a container for your values you want to modify.
-- Raphael