On Fri, May 24, 2002 at 09:32:26AM -0400, Barry Jones wrote:
> 
>  my $results = $test->{testing_results}{testing_result};
>       if(ref($results) eq 'ARRAY') {
>           for my $spot (@$results) {
>              for my $key (keys %$spot) {
>                 if (ref($spot->{$key}) eq 'HASH') {
>                    if($key eq 'value_group') {
>                        ###my %vg = $spot->{$key};

....

> and as you can see in the line with the ### I was just trying to put it
> into a new hash, but that is giving me this error:
> Reference found where even-sized list expected 

Which says that you don't have a hash there, but a hash-reference.

    $vg = $spot->{$key}

will do the job.  You will access it the same way you did with the other
hash-refs

    $vg->{some_key}

Let me reiterate on an little rant I did earlier here on the list:

    Data::Dumper is your friend!

If you're stumbling over an error message that doesn't make sense to
you, I recommend

    use diagnostics;

which would have given you the following:

    ---------- snip ----------
    Reference found where even-sized list expected at x.pl line 9 (#1)
    (W misc) You gave a single reference where Perl was expecting a list
    with an even number of elements (for assignment to a hash). This
    usually means that you used the anon hash constructor when you meant
    to use parens. In any case, a hash requires key/value pairs.  

            %hash = { one => 1, two => 2, };        # WRONG
            %hash = [ qw/ an anon array / ];        # WRONG
            %hash = ( one => 1, two => 2, );        # right
            %hash = qw( one 1 two 2 );                      # also fine
    ---------- snip ----------

Also looking into

    perldoc perldiag

would have given you the same information, although it's left to
discussion if that message would actually have helped in your special
case, now that I'm looking at it.

-- 
                       If we fail, we will lose the war.

Michael Lamertz                        |      +49 221 445420 / +49 171 6900 310
Nordstr. 49                            |                       [EMAIL PROTECTED]
50733 Cologne                          |                 http://www.lamertz.net
Germany                                |               http://www.perl-ronin.de 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to