As a perl novice, I'm unaware what I am doing wrong. Here's what I'm working
with:


use strict;

my @newlist = (
        [ "yes", ['4', '5', '6'] ],
        [ "no" ]
        );

foreach my $foo1 (@newlist) {
        print "[EMAIL PROTECTED]";
        if ($$foo1[0] eq "yes") {
                my @[EMAIL PROTECTED];
                foreach my $foo2 (@ar) {
                        print "foo2=$foo2\n";
                }
        }
}

If the first element of the first subarray is "yes", I want to process
the second element of the first subarray, which is an array itself
However, at the point where it says print "foo2=$foo2\n" I get
foo2=ARRAY(0xXXXXX).

My understanding of this is that $foo1 receives a reference to the contents
of @newlist. Using `$$foo1[0] eq "yes"' treats the index at 0 of the first
subarray as a string, where I can do the comparison. The line
`my @[EMAIL PROTECTED];' assigns the array at index 1 of foo1 to the array @ar,
but I'm sure this is where I am going wrong.


I've been tackling this for the past 48 hours, and am at a loss as to what
to do. If anyone could point out what I'm doing wrong, it'd be greatly
appreciated!


Cheers,
Patrick


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to