which is not working
Blue smoke? It is likely "not working" because use is a compile-time action. With Module::Load it is trivial.
#!/usr/bin/env perl use strict; use warnings; use Module::Load; my @mods = ('JSON', 'CGI::Lite'); for my $mod (@mods) { load $mod; print "$mod version is " . $mod->VERSION . "\n"; }
This can also be done with require if you don't fancy using the module.
In reply to Re: Use 'use' in foreach
by hippo
in thread Use 'use' in foreach
by zidi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |