http://qs1969.pair.com?node_id=671138


in reply to Changing local variables in subroutine by passing by reference?

You have a precedence problem in your dereferencing ($$_[2] and @$_[1]), i.e. you need additional braces.  And, as moritz said, you need to dereference in the assignment, too. IOW, this should work:

... print "count is: ${$_[2]} , reference is: $_[2] \n"; print "data is: @{$_[1]} , reference is: $_[1] \n"; ${$_[2]} = 0; @{$_[1]} = (); ...