my @list = ( { a => 1 }, { a => 15 } ); # here the values of a in the hashrefs are changed, ok! work_( $_ ) for @list; print "_=".(ref $_ ? "r.$_->{a}" : $_) . "\n" for @list; # but here the hashrefs in @list are replaced by scalars, # namely the result of the work_() call. work_( $_, 1 ) for @list; print "_=".(ref $_ ? "r.$_->{a}" : $_) . "\n" for @list; sub work_ { my ($obj, $act) = @_; $obj->{a}++; $_ = $obj->{a} if $act; }