in reply to Re: Why is $a.$b not = "$a$b"?
in thread Why is $a.$b not = "$a$b"?
Good answer! Short, but good.
To expand on that, Perl's operator precedence has '=~' higher than '.'.
So to get the '.' notation to work as I want it to, I assume I should (parenthesise) it, like this:
'eq' is lower than both of those, which explains why my 'eq' tests worked as I expected.$ perl -e '$a="A";$b="B";print "Matches!\n" if ($a.$b) =~ /A/' Matches! $ perl -e '$a="A";$b="B";print "Matches!\n" if ($a.$b) =~ /C/'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Why is $a.$b not = "$a$b"?
by LanX (Saint) on Jul 15, 2020 at 00:21 UTC |