use strict; use warnings; use diagnostics; no strict 'refs'; my $pkg = shift; eval("use $pkg"); my @all = keys %{$pkg . "::"}; print "Subs:\n"; my %subs; for (@all) { if (defined &{$pkg . "::$_"}) { $subs{$_} = ''; } } print join(", ", sort keys %subs), "\n"; print "\nVars:\n"; my %vars; for (@all) { if (defined ${$pkg . "::$_"}) { $vars{$_} = ''; } } print join(", ", sort keys %vars), "\n"; print "\nArrs:\n"; my %arrs; for (@all) { if (defined @{$pkg . "::$_"}) { $arrs{$_} = ''; } } print join(", ", sort keys %arrs), "\n"; print "\nHash:\n"; my %hash; for (@all) { if (defined %{$pkg . "::$_"}) { $hash{$_} = ''; } } print join(", ", sort keys %hash), "\n"; #### defined(%hash) is deprecated at Z:\Data\Perl\PkgName.pl line 39 (#1) (D deprecated) defined() is not usually useful on hashes because it checks for an undefined scalar value. If you want to see if the hash is empty, just use if (%hash) { # not empty } for example. (Maybe you should just omit the defined()?)