in reply to Re^2: passing reference to subroutine
in thread passing reference to subroutine

What do you really want to do? The dereference is as simple as undef @$ref; (see below for the entire updated sub), but I have the strong feeling that you are asking the wrong question and providing the wrong sample code. It seems extraordinary that you would call a sub just to clear an array!

sub undef_ref { my $ref = shift; undef @$ref; print '=' x 20; print "\n"; print Dumper (@$ref); }
True laziness is hard work

Replies are listed 'Best First'.
Re^4: passing reference to subroutine
by asthaonard (Acolyte) on Oct 28, 2011 at 08:54 UTC

    Well, I'm trying to modify an array in a subroutine. I have chose to undef my array because... well... i thought it would be good example. I was wrong :)

    Your code works as expected.

    Thank you very much