A nasty solution to the invocation problem is to use eval. If SomeModule comes from the outside world this is a really bad solution!
use strict; use warnings; my $modName = 'Getopt::Long'; my $fixedMod = $modName; $fixedMod =~ s!::!/!g; $fixedMod .= '.pm'; require $fixedMod; my $length = 24; eval "${modName}::GetOptions('length:i' => \\\$length)";
However, there may be a much better solution to your big picture issue. What are you trying to do that seems to need a require?
In reply to Re: using a variable with require
by GrandFather
in thread using a variable with require
by geoffleach
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |