develooper Front page | perl.perl5.porters | Postings from January 2011

Re: Using smart matching to find whether an array contains a string

Thread Previous | Thread Next
From:
Ed Avis
Date:
January 26, 2011 04:07
Subject:
Re: Using smart matching to find whether an array contains a string
Message ID:
loom.20110126T130609-183@post.gmane.org
Ed Avis <eda <at> waniasset.com> writes:

>>>but I suggest an explicit entry in the 'Smart matching in detail' section
>>>to document the case when $a is an array and $b is a string, which is
>>>currently missing.

>But I don't see that 'string equality' is the semantics?
> 
>    % perl -E '@a = (1, 2, 3); $s = "@a"; say(@a ~~ $s)'

Ah, in fact it appears to be 'reference equality':

    % perl -E '@a = (1, 2, 3); $s = \@a; say(@a ~~ $s)'
    1

I really don't think the documentation is clear on this point.  Should I
submit a patch against perlsyn?

-- 
Ed Avis <eda@waniasset.com>


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