package Base; sub method1 { # Insert code here print "Called from class: ", shift, "\n"; }; package Foo; @ISA = qw(Base); package Bar; @ISA = qw(Base); package main; foreach my $classname qw(Foo Bar) { $classname->method1; } ## Output ## Called from class: Foo Called from class: Bar