I have this script
use strict;
use warnings;
use Data::Dumper;
package Foo;
sub new {bless {'a' => 1, 'b' => sub { return "foo" }}, $_[0]};
my $foo = Foo->new;
print $foo->b()."n";
And when I run it I get Can't locate object method "b" via package "Foo"
Doesnt this code create an anonymous object so I could call the function b
?