in reply to Trouble passing a hash to a module

The main issue is - how perl interprets:
%$self->{simple_hash}
My attempt to explain the issue is likely to create more confusion, so I will leave that to others.

What you could use in recent perls (>=5.20) is the postfix style :

$self->%{simple_hash}

Working code:

use strict; use warnings; {package toy_module; sub new { my ($class, $args) = @_; my $self = { simple_hash => $args->{simple_hash}, simple_test_scalar => $args->{simple_test_scalar}, }; print "********** INSIDE SUBROUTINE NEW **********\n"; return bless $self, $class; } sub show_simple_hash { my $self = shift; print "********** INSIDE SUBROUTINE SHOW_SIMPLE_HASH ********* +*\n"; print "simple scalar: ".$self->{simple_test_scalar}."\n"; print "Simple Hash Key:$_\n" for keys %{$self->{simple_hash}}; } 1; } # End of package toy_module ########## MAIN ################### my $little_test_hashref = { COL_1 => 0, COL_2 => 1, COL_3 => 2, COL_4 => 3, COL_5 => 4, }; my $test_object = toy_module->new({simple_hash=>$little_test_hashref, +simple_test_scalar=>5}); $test_object->show_simple_hash;

                "From there to here, from here to there, funny things are everywhere." -- Dr. Seuss