this

Synopsis

this('$x $y')

Parses the specified string and declares all variables in the string as variables specific to the scope of the current closure.

Parameters

'$x $y' - a string containing variable names separated by spaces.

Side Effects / Notes

Examples

global('$x'); sub foo { this('$x'); $x = $x + 1; println("&foo: \$x is $x"); } $x = "bar!"; foo(); println("global: \$x is $x"); foo(); foo();

&foo: $x is 1 global: $x is bar! &foo: $x is 2 &foo: $x is 3

See Also