in reply to Populating an undefined hashref in a sub
Aliasing is the trick, observefill_hashref (my $href = []);
See Data::Alias foruse DDS; my @snot = 1 .. 2; Dump(\@snot); blot(@snot); Dump(\@snot); glot(@snot); Dump(\@snot); sub blot { $_++ for @_; # @_ holds aliases, $_ also aliases return; } sub glot { my( @copies ) = @_; $_++ for @copies; return; } __END__ $ARRAY1 = [ 1, 2 ]; $ARRAY1 = [ 2, 3 ]; $ARRAY1 = [ 2, 3 ];
alias my ($x, $y) = @_; # named aliases to arguments
|
|---|