in reply to a reference by any other name...

Update:Ignore this answer, as brian_d_foy pointed out - it's wrong. GrandFather has given you a more sensible answer :)

erm, I'm not sure I understand your question - but anyway...

Are you just trying to take a copy of an array and then compare it to the original?

If that's the case, yes - you can do that. Consider the following:

my @foo = qw(a b c d); my @bar = @foo; print "What I want\n" if (@foo eq @bar);
Is that what you wanted?

Replies are listed 'Best First'.
Re^2: a reference by any other name...
by brian_d_foy (Abbot) on Feb 20, 2006 at 01:45 UTC

    That won't work, of course, because the eq operates on scalars. An array in scalar context give the count of the number of elements, so as long as those arrays have the same number of elements, this code says they are the same. That' salmost never what you want. :)

    --
    brian d foy <brian@stonehenge.com>
    Subscribe to The Perl Review