[Israel.pm] Is there an operator like IN in perl

Yitzchak Scott-Thoennes sthoenna at efn.org
Thu Mar 5 08:50:52 PST 2009


On Thu, March 5, 2009 8:26 am, Offer Kaye wrote:
> On Thu, Mar 5, 2009 at 5:51 PM, Mikhael Goikhman wrote:
>> So the only real problem of this powerful operator is that it requires
>> perl 5.10. Meaning, for example, I can't use it in my projects yet.
>
> Another problem is that it is going to be changed in 5.10.1 in
> non-backwards-compatible ways. See:
> http://www.nntp.perl.org/group/perl.perl5.porters/2009/03/msg144727.html
>
> So even if I could use it, I wouldn't ;)

Note the "you'll notice that most common cases will not be
changed, or changed in dwimmy ways".

A little bit of history: perl 5's smart match was modeled off of the plans
for perl 6.  Then the perl 6 plans went through a common-sensification,
making the operator produce more predictable results in a lot of cases.
But no one on the perl 5 side noticed this until it was too late to fix
it for 5.10.

The biggest change was that ~~ is no longer commutative; that is, which
of its several possible types of operation is chosen is usually determined
by only the right operand.  So as long as you phrase your use of it in
what is probably the most natural way, you should see no change between
5.10 and any future versions.  And to be completely certain of being safe,
you have only to consult the documentation:

http://perl5.git.perl.org/perl.git/blob_plain/HEAD:/pod/perlsyn.pod
("Smart matching in detail").




More information about the Perl mailing list