Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Why is $a.$b not = "$a$b"?

by tel2 (Pilgrim)
on Jul 15, 2020 at 00:08 UTC ( #11119330=note: print w/replies, xml ) Need Help??


in reply to Re: Why is $a.$b not = "$a$b"?
in thread Why is $a.$b not = "$a$b"?

Thank you tybalt89!

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:

$ 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/'
'eq' is lower than both of those, which explains why my 'eq' tests worked as I expected.

Right?

Replies are listed 'Best First'.
Re^3: Why is $a.$b not = "$a$b"?
by LanX (Cardinal) on Jul 15, 2020 at 00:21 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11119330]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2020-10-29 03:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (267 votes). Check out past polls.

    Notices?