in reply to Re: dynamic sub routine definitions?
in thread dynamic sub routine definitions?

Hmm, one additional question though. Is there a way to do something like "require" but on a scalar variable? So let's say I read in this module file into $the_mod. I can't obviously just say "require $the_mod"
my $mod = "Carp.pm"; require $mod; Carp::croak ("Oh yes, you can.\n");

Abigail

Replies are listed 'Best First'.
Re: Re: dynamic sub routine definitions?
by Eradicatore (Monk) on Jul 18, 2002 at 02:51 UTC
    Thanks again! I wasn't clear enough though in my question. What I mean was, if I have $var set to some big long string that is really a function (not a file name) then could I then say something like "require $var"?

    Justin Eltoft

    "If at all god's gaze upon us falls, its with a mischievous grin, look at him" -- Dave Matthews

      No, but you can use eval.

      Abigail