#!/usr/bin/perl -l use strict; use warnings; { package Foo; sub bar {}; } foreach my $type ( qw ) { print $type if defined *Foo::bar{$type}; }