#!/usr/bin/perl -w
use strict;
package Foo;
sub new {
bless({}, $_[0]);
}
sub do_it {
print "Doing something for $_[0]!\n";
}
package main;
my $foo = new Foo;
####
my $do_it = \&Foo::do_it;
$do_it->('direct call');
####
my $ref = ref($foo);
my $do_it2;
eval "\$do_it2 = \\&${ref}::do_it";
$do_it2->('indirect call');