in reply to How to create dynamic global variables
I have problems to completely understand your request; I hope my guess will be helpful to you.
You could use a global hash which uses the module's name as key and the object as value.
#! /opt/perl/bin/perl # vim: set ts=4 sw=4 sts=4 et nu: use strict; use warnings; use Data::Dumper; my %object; my @modules = qw( CGI ); for my $mod ( @modules ) { eval "use $mod; \$object{$mod} = $mod->new; 1;" or die "eval faile +d: $@\n"; } print Dumper \%object;
In Section
Seekers of Perl Wisdom