X = Y = Z #### Y = Z X = Y #### #!/usr/bin/env perl use strict; use warnings; use Data::Dumper; { # Contrived, arbitrary values for your variables my %hash1; my %hash2 = (b => [ 1, 2, 3 ]); my ($a, $b) = qw{a b}; # Your code my $sub = $hash1{$a} = $hash2{$b}; push @$sub, $a; # Your data print Dumper $sub; } { # Possibly more meaningful variable names (with same values) my %some_HoA; my %other_HoA = (b => [ 1, 2, 3 ]); my ($key_a, $key_b) = qw{a b}; # Possibly more understandable code $some_HoA{$key_a} = $other_HoA{$key_b}; my $some_array_ref = $some_HoA{$key_a}; push @$some_array_ref, $key_a; # More obvious data? print Dumper $some_array_ref; } #### $VAR1 = [ 1, 2, 3, 'a' ]; $VAR1 = [ 1, 2, 3, 'a' ];