I'm running perl 5.10! -- perl -v This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi --
A think it's no longer true then: "The smart match operator is commutative, which you may remember from high school algebra as the fancy way to say that the order of the operands doesn’t matter.", from 'Learning Perl' book. Thanks! > Ah - are you running 5.12? I tried running the above > with Perl 5.12, and replicated your behavior. Smart > matching changed with 5.12: > > chap-VirtualBox:/home/chap/private/perl$ cat smart > - - - > use 5.010; > use strict; > use warnings; > > my @divisors = (1, 2); > say "Array~~Scalar: It's divisible by 2!" if @divisors ~~ > 2; > say "Scalar~~Array: It's divisible by 2!" if 2 ~~ > @divisors; > - - - > chap-VirtualBox:/home/chap/private/perl$ perl > smart # running Perl 5.12.2 > Scalar~~Array: It's divisible by 2! > > Offhand I don't see exactly what accounts for the new > behavior, apart from the non-commutativity that was > introduced. It is probably covered here, but I'm not > seeing it. > > http://search.cpan.org/~jesse/perl-5.12.2/pod/perl5120delta.pod#Smart_match_changes > > Regards, Chap > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/