in reply to Re: passing the reference from a class.
in thread passing the reference from a class.

sory the message is :

can't use string ("\%hashsecond") as a HASH reference while "strict refs" in use

i mean it is obvious but i don't know why aoes dthi happen only the second time

and thanks for the tip it is a typo :)

  • Comment on Re^2: passing the reference from a class.

Replies are listed 'Best First'.
Re^3: passing the reference from a class.
by Corion (Patriarch) on Jul 20, 2008 at 20:08 UTC

    It works as it should for me:

    use strict; sub create { my $self = @_; my (%hash1,%hash2); my @vi = qw(\%hash1 \%hash2); return @vi; } my @array = create(); #i did the separation of variables on purpose ... my $first = $array[0]; my $second = $array[1]; my %hashfirst = %$first; my %hashsecond = %$second; __END__ Can't use string ("\%hash1") as a HASH ref while "strict refs" in use +at tmp.pl line 20.

    This is because you're returning strings instead of references:

    my @vi = qw(\%hash1 \%hash2);
    should be
    my @vi = (\%hash1, \%hash2);