Passing subroutine names via ARGV and calling them. How?

I'd like to pass in subroutine name(s) as arguments to the script and call them.
For example,

"perl myprogram subname1 subname5"

my script will get the names from ARGV and call each one.

How to do this?

YY

Comments

  • Hi,

    How about something like:-

    [code]
    foreach (@ARGV) {
    my $command = '&' . $_ . ';';
    eval ($command); #You could put these as 1 line...
    }
    [/code]

    Of course, there are potential security worries in there, so if this is a script used by many, I'd probably want to be validating it somehow.

    Hope this is what you meant/my code is right,

    Jonathan


    -------------------------------------------
    Count your downloads:
    http://www.downloadcounter.com/
    And host your site:
    http://www.incrahost.com/
    Don't say I never give you anything... ;-)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion