package Whatever; { # anything outside this scope can't call this: my $private1 = sub { print "hello"; }; # everybody can call Whatever::foo sub foo { $private1->(); # call private method print " world\n"; } } foo();