in reply to Re: Error : Can't use a hash as a reference
in thread Error : Can't use a hash as a reference

Hi Corion, when i run my code in perl 5.10 it gives me the results.
atyagi@qtspg-1 ~$ perl perlHash.pl
Using a hash as a reference is deprecated at perlHash.pl line 10.
Using a hash as a reference is deprecated at perlHash.pl line 11.
Using a hash as a reference is deprecated at perlHash.pl line 12.
1.1 after method call $VAR1 = 'claimList';
$VAR2 = undef;
$VAR3 = 'error';
$VAR4 = undef;
$VAR5 = 'contractList';
$VAR6 = '';

same code i am runing in 5.26.1 its give me an error.
Can't use a hash as a reference at perlHash.pl line 10.

#!/usr/bin/perl -w # use strict; use warnings; use Data::Dumper; my %rowRetrun; %rowRetrun->{'contractList'} = ""; %rowRetrun->{claimList} = (); %rowRetrun->{error} = (); print "1.1 after method call ", Dumper(%rowRetrun);

Replies are listed 'Best First'.
Re^3: Error : Can't use a hash as a reference
by Corion (Patriarch) on Nov 21, 2018 at 12:20 UTC

    Again: That's not how you access a hash.

    Maybe you want:

    $rowRetrun{ 'contractList' } = "";
      Thanks Corion. its working now.