- or download this
$count = 10;
- or download this
$copy = $count;
- or download this
$ref = \$count; # initialise $ref's value to be a reference to $count
- or download this
print "ref $ref\n";
ref SCALAR(0x000003e8)
- or download this
print "ref value $$ref\n";
ref value 10
- or download this
@array = (10, 20, 30);
- or download this
@copy = @array;
- or download this
$ref = \@array;
- or download this
print "ref $ref\n";
ref ARRAY(0x000003e8)
- or download this
print $ref->[1];
20
- or download this
print $$ref[1];
20
- or download this
%hash = (a => 1, b => 2);
- or download this
$ref = \%hash;
- or download this
print "ref $ref";
...
print $$ref{b};
2
- or download this
$array[1] = @another; # nope - number of entries in @another is assign
+ed to $array[1]
- or download this
$array[1] = \@another;
print $array[1]->[0]; # the first entry in the referenced array
- or download this
sub func {
...
}
func(@ten_million);
- or download this
sub func {
my ($aref) =@_;
...
}
func(\@ten_million);
- or download this
$ref = \@array;
...
print "ref $ref\n";
1001