1 |
We can more miraculously set
|
2 |
$name="foo"; # define an innocent ascii string
|
3 |
${$name} = 6; # sets $foo=6 as though $name was a symbolic reference
|
4 |
$$name = 6; # also sets $foo=6
|
5 |
$name->[0] = 4; # sets $foo[0] = 4
|
6 |
${$name x 2} = 6; # sets $foofoo = 6 ; # remember definition of x for strings
|
7 |
@$name = (); # sets @foo to null list while
|
8 |
&$name(arguments); # calls subroutine foo with given arguments!
|
9 |
use strict 'refs'; # FORBIDS symbolic references and above syntax will lead to error messages
|
10 |
*PI =\3.14159; # ensures that $PI is set in a way that you can not override it!
-
i.e. $PI = 3; # generates an error
|