while ( my($module, $args) = each %$toLoad ) { my $str = "use $module "; # to fix typo in example $str .= 'qw(' . $args . ')' if $args ne '1'; eval $str; # Try and remap symbol tables to the right spot unless ( $args eq '1' ) { no strict 'refs'; foreach my $key ( split/\s+/, $args ) { *$key = *$module::$key; } } # END unless args eq 1 } # END while each toLoad