I am new to perl and seriously finding it difficult to use its object oriented features as I come from C++,python Background. I wanted to create a list of objects , but I dont know how to achieve this in perl. I started with an array , but that doesn't seem to be working.
package X;
sub new {
.....
}
package Y;
sub new {
.....
}
package Z;
my @object_arr = ( X::new, Y::new);
foreach $object (@object_arr) {
$object->xyz();
}
This throws an error "Can't call method "xyz" without a package or object reference ". Any help is appreciated.