package Foo::Bar::Baz; use vars '$quux'; print "What should \$quux hold?\n: "; chomp( $quux = ); package main; use strict; my $hash = \%main::; for my $key (qw( Foo Bar Baz )) { $hash = $hash->{ $key . '::' }; } print "Quux is: ${ $hash->{quux} }\n";