my $subname = 'baz';
my $param = { abc => 'xyz' }; # or an object. whatever.
eval 'foo->' . "$subname( \$param )";
####
# first, the string that is to be eval'ed is created
'foo->' . "$subname( \$param )" => 'foo->baz( $param )'
# then the eval kicks in
eval 'foo->baz( $param )'
# which is effectively means
foo->baz( $param );
# where $param is the ref to a hash
####
# suppose we use "$subname( $param )"
'foo->' . "$subname( $param )" => "foo->baz( 'HASHx(....)' )"
# where HASHx(...) is the string representation of the
# hash ref. this happens because you're interpolating
# the hashref within the string
end result => foo->baz( 'HASHx( .... )' );
----
# what if we use "baz( $param )" ?
'foo->' . "baz( $param )" => "foo->baz( 'HASHx(....)' )"
# ah, same as the example above
end result => foo->baz( 'HASHx( .... )' );
----
# suppose we use '$subname( $param )'
'foo->' . '$subname( $param )' => 'foo->$subname( $param )'
# so no interpolation is done in the first step...
foo->$subname( $param ); # ah, but this is perfectly valid!