develooper Front page | perl.perl6.language | Postings from August 2006

Re: === and array-refs

Thread Previous | Thread Next
From:
David Green
Date:
August 17, 2006 10:26
Subject:
Re: === and array-refs
Message ID:
a06230903c10a45b84426@[172.27.1.7]
On 8/17/06, Darren Duncan wrote:
>At 11:16 PM -0600 8/16/06, David Green wrote:
>>I just want [1,2] to be === to [1,2], or [1,2, \@x] to be equal to 
>>[1,2, \@x] but !=== [1,2, \@y] -- eqv won't work in the latter case 
>>(regardless of Seq vs. Array -- I didn't think it made a difference 
>>here).
[...]
>Since you are wanting to compare two mutable Array, just use the eqv 
>operator, which will do everything you want in a terse and easy to 
>understand manner.

No, look at the example I've been using.  Two arrays (1, 2, \@x) and 
(1, 2, \@y) clearly have different (unevaluated) contents.  "eqv" 
only tells me whether they have the same value (when @x and @y are 
evaluated).  That's a different question -- yes, it's the more common 
question, but I think the comparison I want to make is just as 
reasonable as ===, except there's no easy way to do it.


-David

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About