operators - What does ~~ in perl do? -
i saw code , couldn't understand doing compiled succesfully.i searched ~~ operator no luck.
unless ($1 ~~ @tables) { push @tables, $1; }
reference: http://perldoc.perl.org/perlop.html#smartmatch-operator
first available in perl 5.10.1 (the 5.10.0 version behaved differently), binary ~~ "smartmatch" between arguments.
the ~~ operator compares operands "polymorphically", determining how compare them according actual types (numeric, string, array, hash, etc.) equality operators shares same precedence, ~~ returns 1 true , "" false. best read aloud "in", "inside of", or "is contained in", because left operand looked inside right operand. makes order of operands smartmatch operand opposite of regular match operator. in other words, "smaller" thing placed in left operand , larger 1 in right.
Comments
Post a Comment