Crunch::WalMart Crunch::ExxonMobil Crunch::GeneralMotors Crunch::FordMotorCompany Crunch::GeneralElectric . . . . . . Crunch::SupervaluInc Crunch::CiscoSystemsInc #### use File::Spec::Functions 'catdir'; sub do_em { my $path_to_companies = shift; opendir $dh, $path_to_companies or die "Can't opendir $path_to_companies: $!\n"; while ( my $company = readdir( $dh ) ) { next if $company ~= /^\./; my $dir = catdir( $path_to_companies, $company ); next unless -d $dir; my $module = 'Crunch::' . $company; eval "require $module; $module\::do_it( '$dir' ); 1" or die; } } #### use File::Spec::Functions 'catdir'; { my @do_it = ( \&do_WalMart, \&do_ExxonMobil, . . . \&do_CiscoSystemsInc, ); sub do_em { my $path_to_companies = shift; $_->( $path_to_companies ) for @do_it; } } sub do_WalMart { my $name = 'WalMart'; my $dir = catdir( shift, $name ); # blah blah blah }