Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: smart match operator should be smarter!

by Jorge_de_Burgos (Beadle)
on Nov 22, 2009 at 20:09 UTC ( #808678=note: print w/replies, xml ) Need Help??

in reply to smart match operator should be smarter!

1. This is your untouched code and my results:
use strict; use warnings; use 5.010; my @numbers = (2); my @other = (2); if (@numbers ~~ @other) { say 'yes' }else{ say 'no'; } #output: yes if (@numbers ~~ (2)) { say 'yes' }else{ say 'no'; } #output: yes

2. This is my perl -v:

This is perl, v5.10.0 built for i486-linux-gnu-thread-multi

3. Could you post here the output of your perl -v?

Replies are listed 'Best First'.
Re^2: smart match operator should be smarter!
by 7stud (Deacon) on Nov 23, 2009 at 00:09 UTC

    ikegami said earlier that the smart operator was changed after version 5.10.0. Apparently, it was buggy and too unwieldy to work with. As a result, it is no longer commutative.

    $ perl -v
    This is perl, v5.10.1 (*) built for darwin-2level
    Copyright 1987-2009, Larry Wall
    Perl may be copied only under the terms of either the Artistic License or the
    GNU General Public License, which may be found in the Perl 5 source kit.
    Complete documentation for Perl, including FAQ lists, should be found on
    this system using "man perl" or "perldoc perl".  If you have access to the
    Internet, point your browser at, the Perl Home Page.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://808678]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2023-01-28 00:56 GMT
Find Nodes?
    Voting Booth?

    No recent polls found