$ref = \something |
ref = something |
In python everything is a reference.
$hashref = {a=>1,
b=>2};
$arrayref = [1, 2, 3, 4];
$scalar = 'h';
$scalarref = \$scalar;
sub a {1};
$subref = \&a;
# or $subref = sub {1};
&$subref;
a;
$refref = \$ref;
$undef;
$undefref = \$undef;
|
hashref = {'a': 1, #'dictionary'
'b': 2}
arrayref = [1, 2, 3, 4] #'list'
arrayref = (1, 2, 3) #'tuple'
scalarref = 'h'
def a(): return 1
subref = a #'function'
subref() # parentheses trigger a subroutine
a()
reflist = [subref] # no exact match
reftuple = (subref,)
undefref = None
|