http://qs321.pair.com?node_id=1230729


in reply to Re^2: accessing stashes
in thread accessing stashes

$My::{$symbol} returns a glob.

*NAME{SLOT} accesses a glob's slot.
*BLOCK{SLOT} accesses a glob's slot.
*$NAME{SLOT} accesses a glob's slot.
EXPR->*{SLOT} accesses a glob's slot.[1]

So,

my $glob = $My::{$symbol}; $glob && *{ $glob }{CODE} $glob && *$glob{CODE} $glob && $glob->*{CODE}

  1. Requires Perl 5.24+. Available in Perl 5.20+ by adding both use feature qw( postderef ); and no warnings qw( experimental::postderef );, or by adding use experimental qw( postderef );.