You can also do this completely with built-in functions:
package Foo;
use constant MY_CONST =>
{
'foo' => 'bar',
'baz' => {
'innerbar' => 'bleh',
},
};
sub some_method
{
$a = MY_CONST->{foo};
}
package Main;
my $b = Foo->MY_CONST->{baz}{innerbar};
Ether source
share