in reply to How to correct pass variable to and from called function?
If you Use strict and warnings, which you always should, then you would see the error message "Can't use string ("1") as a HASH ref while "strict refs" in use".
In my $self = @_;, you're using the array @_ in scalar context, which returns the number of elements, 1. You want either my ($self) = @_; or my $self = shift; instead. The former causes the right-hand side to be evaluated in list context, returning the elements of the array, and for the latter, see shift.
|
|---|