$ cat foo.conf my %conf = ( passwd => 'joe', uname => 'joe', foo => 1, ); \%conf; $ perl -w -Mstrict -e 'BEGIN{my $conf = do "foo.conf";sub whisper {print $conf->{passwd},$/}} whisper()' joe