asthaonard has asked for the wisdom of the Perl Monks concerning the following question:
Hello
I need some advise in, i think, very trivial situation. I want to undef an array in a sub, but somehow it still exists outside that sub.
My code follows
use strict; use warnings; use Data::Dumper; sub undef_ref { my $ref = shift; my @struct = @$ref; undef @struct; print '='x20; print"\n"; print Dumper(@struct); } my @struct = ('a','b','c','d','e'); undef_ref(\@struct); print '='x20; print"\n"; print Dumper(@struct);
What am I missing?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: passing reference to subroutine
by chromatic (Archbishop) on Oct 28, 2011 at 08:09 UTC | |
Re: passing reference to subroutine
by GrandFather (Saint) on Oct 28, 2011 at 08:12 UTC | |
by BrowserUk (Patriarch) on Oct 28, 2011 at 08:18 UTC | |
by asthaonard (Acolyte) on Oct 28, 2011 at 08:31 UTC | |
by GrandFather (Saint) on Oct 28, 2011 at 08:40 UTC | |
by asthaonard (Acolyte) on Oct 28, 2011 at 08:54 UTC | |
by RichardK (Parson) on Oct 28, 2011 at 10:03 UTC | |
Re: passing reference to subroutine
by BrowserUk (Patriarch) on Oct 28, 2011 at 08:42 UTC | |
by asthaonard (Acolyte) on Oct 28, 2011 at 09:17 UTC | |
by wfsp (Abbot) on Oct 28, 2011 at 11:33 UTC | |
Re: passing reference to subroutine
by mrstlee (Beadle) on Oct 28, 2011 at 11:56 UTC |