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:
Eric Brine
Date:
January 26, 2011 08:53
Subject:
Re: Using smart matching to find whether an array contains a string
Message ID:
AANLkTinGM+_sv-4VyJbCdQfu-mXn0P67O5EBdrmx6zVQ@mail.gmail.com
On Wed, Jan 26, 2011 at 7:01 AM, Ed Avis <eda@waniasset.com> wrote:

> Further, it's not clear how the '$a eq $b' in the 'Any  Any' line applies
>
when the left hand side is not a scalar but an array; not $a but @a.
>

The operands are always scalar. @a is a shortcut for \@a. *That* is what
isn't clear.

 But I don't see that 'string equality' is the semantics?
>

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

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

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