in reply to Using $variable in place of "Method" in Module::Submodule::Method( @args )
Here is an example:
#!/usr/bin/perl use strict; use warnings; package Module::MyModule; sub pass { my ($function, @args) = @_; my $f = \&{"Module::MyModule::" . $function}; return $f->(@args); } sub test { my (@args) = @_; return join ", ", @args; } package main; print Module::MyModule::pass("test", qw(1 2 3 4));
Update: modified to support strict.
Igor 'izut' Sutton
your code, your rules.
|
---|
In Section
Seekers of Perl Wisdom