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]} = (); ...

Replies are listed 'Best First'.
Re^2: Changing local variables in subroutine by passing by reference?
by why_bird (Pilgrim) on Feb 29, 2008 at 10:32 UTC
    That might answer my question before.. I'll read up on operator precedence.. Thanks :)
    -------------------------------------------------------------
    Those are my principles. If you don't like them, I have others.
    -- Groucho Marx
    --------------------------------------------------------------