in reply to passing a $var thru a "use module($var)"

Yes, the implicit BEGIN{} around use is killing you. But it's easy enough to kill it first:

my $pid; BEGIN { $pid = $$ } use Module $pid; # ta da

As a separate matter, you should beware about a numeric first argument to use because Perl may interpret it as a minimum required version for the given module.

    -- Chip Salzenberg, Free-Floating Agent of Chaos

Replies are listed 'Best First'.
Re: Re: passing a $var thru a "use module($var)"
by Anonymous Monk on Mar 17, 2004 at 04:53 UTC
    As a separate matter, you should beware about a numeric first argument to use because Perl may interpret it as a minimum required version for the given module.
    Not exactly because use isn't exactly a function (use(CGI=>3);).
    $$ perl use CGI 3; # what you're talking about use CGI ( 66 ); # a numeric literal, 1st argument, statement succeeds use CGI 66; # dies as should CGI version 66 required--this is only version 3.04 at - line 3. BEGIN failed--compilation aborted at - line 3.