my $ref; { my @array = 'element'; $ref = \@array; } # Because the array is lexically scoped (my), # the array would normally be freed here*, # but the reference is keeping it alive. print "$ref->[0]\n"; # Prints 'element' $ref = undef; # The scalar stops referencing the array, # so it's freed here.