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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -