1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/perl use strict; use warnings; use 5.010; #--------------- my $lokal_config = sub { my ($c) = @_; $c->{foo}='bar'; }; my %lokal; &$lokal_config(\%lokal); say keys %lokal; #--------------- my %test = (foo => sub { my ($c) = @_; $c->{foo2}='bar'; }); my %lokal2; $test{foo}(\%lokal2); say keys %lokal2;
2013-12-01T09:52:33 GwenDragon$lokal_config(\%lokal); dereferenziert nicht automatisch.
Warum der Perl-Parser bei $test{foo}(\%lokal2); , einem Sub-Aufruf über den Hashwert automatisch Derefernzierung verwendet, hab ich jetzt nicht parat.