Hi Billy, please reply to all recipients.
On Fri, 7 Nov 2014 13:17:19 +0000 "Patton, Billy N" <billy.pat...@h3net.com> wrote: > I currently have something like this > use MyFoo::ABCBar; > use MyFoo::DEFBar; > use MyFoo::HIJBar; > my $fooABC = MyFoo::ABCBar->new(); > … > > What I would like to do is > > foreach $pgm ( ‘ABC’ , ‘DEF’ , ‘HIJ’) { > my $foo = MyFoo::{$pgm}Bar->new; The correct syntax is simply (untested): my $foo = "MyFoo::${pgm}Bar"->new; I should note though that this may make the module names harder to grep for in the files, and you may opt to use a hash instead. Regards, Shlomi Fish > … > } > > This gives me an error. > What is the correct syntax? -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Understand what Open Source is - http://shlom.in/oss-fs After Chuck Norris said “I don’t believe in fairies.”, fairies have become extinct. — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/ Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/