in reply to Re: Can you use a scaler as an operator?
in thread Can you use a scaler as an operator?
Rather than using a defined vs undefined value for the op variable, here's an example of that approach using 'i' vs either '#' or '' (empty string).
>perl -wMstrict -le "my $s = 'ASdf'; ;; for my $op ('i', '#', '') { printf qq{for op eq '$op': }; print 'asdf' =~ m{ (?$op) \Q$s\E }xms ? '' : 'NO ', 'match'; } " for op eq 'i': match for op eq '#': NO match for op eq '': NO match
Update: '-i' also works for turning off (or not turning on) case-insensitive matching.
|
|---|