{ package MyDate; use strict; use warnings; sub AUTOLOAD { our $AUTOLOAD; say "Going into AUTOLOAD"; # Why doesn't this print? my $method = $AUTOLOAD; $method =~ s/.*:://; grep {$method eq $_} qw/yak day month/ or Carp::croak "Invalid method: $method."; if ($method eq "day") { eval { sub day {(localtime)[3];} }; } elsif ($method eq "month") { eval { sub month {(localtime)[4] + 1;} }; } Carp::croak $@ if $@; goto &$method; } } ######################################################################################## package main; use strict; use warnings; say MyDate->day; say MyDate->month; #### String found where operator expected at 879141.pl line 6, near "say "Going into AUTOLOAD"" (Do you need to predeclare say?) String found where operator expected at 879141.pl line 9, near "Carp::croak "Invalid method: $method."" (Do you need to predeclare Carp::croak?) syntax error at 879141.pl line 6, near "say "Going into AUTOLOAD"" syntax error at 879141.pl line 9, near "Carp::croak "Invalid method: $method."" BEGIN not safe after errors--compilation aborted at 879141.pl line 26.