sometimes I forget these differences.
sub hoge {
my $self = @_;
sub hoge {
my($self) = @_;
sub hoge {
my ($self) = @_;
First of all, show the result.
my $self = @_;
warn "aaaaaaaaaaaaaaaaaaaaaaa";
warn Dumper $self;
warn "bbbbbbbbbbbbbbbbbbbbbbb";
my($self) = @_;
warn Dumper $self;
warn "ccccccccccccccccccccccc";
my ($self) = @_;
warn Dumper $self;
I know the result, but I could not understand the reason.
my $self = @_;
# This means Receiving Value of Array by Scalar. $self is Scalar. @_ is Array.
# $self receives the number of Elements of Array.
my($self) = @_;
# This means Receiving Value of Array by Array. ($self) is array.
# So $self receives only the 1st value of @_ as Array.
↑↑ Then I think you should use my $self = shift.
my ($self) = @_;
# same to above.