in reply to Re: Re: Re: Re: Understanding why strict prevents a use of local
in thread Understanding why strict prevents a use of local

my %argHash = ( abcd => 'efgh', ijkl => 'mnop', ); &first(\%argHash); sub first { my $args = shift; print "$_ => $args->{$_}\n" foreach sort keys %$args; &second({%$args, qrst => 'uvwx'}); } sub second { my $args = shift; print "$_ => $args->{$_}\n" foreach sort keys %$args; }
Or, if you don't want to use hashrefs, you can do
my %argHash = ( abcd => 'efgh', ijkl => 'mnop', ); &first(\%argHash); sub first { my %args = @_; print "$_ => $args->{$_}\n" foreach sort keys %args; &second(%$args, qrst => 'uvwx'); } sub second { my %args = @_; print "$_ => $args{$_}\n" foreach sort keys %args; }
Note how the two use different braces at different times. Either is just fine. The second is prone to more errors in coercing the array @_ into the hash %args, but, so long as you know exactly what's going into that hash, you should be fine. Try them out and see which you prefer.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.