sub foo { my $self = shift; $self->{changed}->{foo} = shift if $#_ > -1; return $self->{changed}->{foo} || $self->{data}->{foo}; } $x->foo('bar'); # This is recognized push @{ $x->foo->{bar}->{itemlist} },1; # This isn't