#!/usr/bin/perl -w use strict; use Data::Dumper; BEGIN { my @arr = ( { box => { attr => { this => 'that', foo => 'bar', }, content => {}, }, }, ); sub gimme { my @result = @arr; return \@result; } } my $box1_ref = gimme(); $box1_ref->[0]->{white_box}->{content}->{apples} = 5; print "tracing: $box1_ref -> $box1_ref->[0] -> $box1_ref->[0]->{white_box} -> $box1_ref->[0]->{white_box}->{content}\n"; print Dumper $box1_ref->[0]->{white_box}->{content}; my $box2_ref = gimme(); print "tracing: $box2_ref -> $box2_ref->[0] -> $box2_ref->[0]->{white_box} -> $box2_ref->[0]->{white_box}->{content}\n"; print Dumper $box2_ref->[0]->{white_box}->{content};