Reference Counting and Destruction : Array Value « Array « Perl






Reference Counting and Destruction

    

#!/usr/bin/perl
use warnings;
use strict;
my $ref;
{
    my @array = (1, 2, 3);
    $ref = \@array;
    my $ref2 = \@array;
    $ref2 = "Hello!";
}
undef $ref;

   
    
    
    
  








Related examples in the same category

1.Change value in an array
2.Sum values in an array
3.Totalling a List
4.A program that copies an array and compares the elements of the two arrays.
5.A program that assigns a list as part of another list.
6.Determine the mean
7.Discard words until we see the "A" marker
8.Empty list
9.Filling an array with 100 zeroes by using the 'x' operator
10.Filling an array with a sequence of numbers by using the '..' operator
11.Mix data type in an array
12.Accessing Elements: Populating an array and printing its values