Hello Experts, We recently upgraded from Perl 5.8.8 to Perl 5.16.3. We started seeing strange issues with hash dereferencing issues. below script use to work fine in 5.8.8 and is causing issues in 5.16.3. we have a number scripts which use below kind of notation, is there anyway to make the below script to work by changing some perl generic settings rather than changing the scripts??
#!/usr/bin/env perl use strict; use Data::Dumper; my %lHash; $lHash{'a'} = 1; $lHash{'b'} = 2; my $lHashRef = \%lHash; my $lValue1 = $lHashRef->{'a'}; print $lValue1."\n"; print Dumper($lHashRef); print ref($lHashRef) . "\n"; my $lValue = ${%{$lHashRef}}{'a'}; print $lValue."\n"; exit 0;
it gives me...
$ perl deref_test.pl 1 $VAR1 = { 'a' => 1, 'b' => 2 }; HASH Can't use string ("2/8") as a HASH ref while "strict refs" in use at d +eref_test.pl line 14.
i tried using no strict "refs", then the warning goes away but it does not print the hash value. Below is the output from older version of Perl (5.8.8)
$ perl perl_deref.pl 1 1 $VAR1 = { 'a' => 1, 'b' => 2 }; HASH 1
In reply to hash dereferencing issue with perl 5.16.3 by KANAKADANDI
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |