in reply to Create a new operator, get LHS

If i'm not wrong you can do that with smart matching:

Smartmatch Operator
if ( $var ~~ @whatever ) { #do something }

Update: However, when you do a string check comparison then I don't think smart matching would work. For example:

#!/usr/bin/python some_var = 'sa' words = 'same' if some_var in words: print "yes"

In python you can even step through a string like a list and index it. That would not be possible in Perl.

Replies are listed 'Best First'.
Re^2: Create a new operator, get LHS
by Laurent_R (Canon) on Aug 27, 2015 at 15:41 UTC