Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Dynamic Package Name & Subroutine Call

by davido (Cardinal)
on Dec 14, 2012 at 22:37 UTC ( [id://1008910]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package Test::One;
    
    ...
    foreach my $pkg ( @pkgs ) {
        "Test::$pkg"->hello();
    }
    
  2. or download this
    foreach my $pkg ( @pkgs ) {
        no strict 'refs';
        &{'Test::' . $pkg . '::hello'}($pkg);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1008910]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 07:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found