package Test; $testing = 'TEST'; @test_array = (qw/OneTest TwoTest/); %test_hash = ('testkey' => 'testvalue'); foreach my $symname (sort keys %Test::) { local *sym = $Test::{$symname}; if (defined $sym) {$sym = undef; print "\$$symname is cleared\n" }; if (@sym) {@sym = undef; print "\@$symname is cleared\n" }; if (%sym) {%sym = undef; print "\%$symname is cleared\n" }; }