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

You are using a hash: %rowRetrun as a reference: %rowRetrun->. This is not allowed in Perl.

Maybe you meant to use $rowRetrun->... ?

Replies are listed 'Best First'.
Re^2: Error : Can't use a hash as a reference
by anjultyagi (Novice) on Nov 21, 2018 at 12:16 UTC

    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);

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

      Maybe you want:

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