in reply to passing reference to subroutine
The perlreftut & perlref pages in the core documentation is a great place to start.use strict; use warnings; use Data::Dumper; sub undef_ref { my $ref = shift; my @struct = @$ref; undef @$ref; ## Blow away original print '='x20; print"\nStruct is\n"; print Dumper(@struct),"\nIn undef_ref\n"; } my @struct = ('a','b','c','d','e'); undef_ref(\@struct); print '='x20; print"\n"; print "Struct is\n",Dumper(@struct),"\nOutside undef_ref\n";
|
---|