For example, for main:
foreach my $name (sort keys %{*main::}){
print "Symbol '$name'\n";
}
chas
(Update: Using
BUU's construction if the name is in a variable.
Update 2: That construction seemed fine when $package="main",
but doesn't seem right for cases such as $package="HTML::Parser", when the :: appears. For such cases,
tlm's construction seems to give the desired result.)