- or download this
my $subname = 'baz';
my $param = { abc => 'xyz' }; # or an object. whatever.
eval 'foo->' . "$subname( \$param )";
- or download this
# first, the string that is to be eval'ed is created
'foo->' . "$subname( \$param )" => 'foo->baz( $param )'
...
foo->baz( $param );
# where $param is the ref to a hash
- or download this
# suppose we use "$subname( $param )"
'foo->' . "$subname( $param )" => "foo->baz( 'HASHx(....)' )"
...
# so no interpolation is done in the first step...
foo->$subname( $param ); # ah, but this is perfectly valid!