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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.