=~ binds a scalar expression to a pattern match, eg:
print "Matches!" if "hello" =~ m/he/;The period (.) is a concatenation operator. When used in conjunction with = it concatenates the right argument to the left argument. For example..
$foo = "hello" .= " world";Is the same as..
$foo = "hello world";
Cheers,
Darren :)
=~ can also be used in list context to obtain the list of captures: $1, $2, etc.
--
Oh Lord, wont you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, wont you burn me a Knoppix CD ?
(Missquoting Janis Joplin)
Not to be overly nitpicky, but that behavior is from the m// operator, not =~. I think this distinction is important to keep in mind, because =~ can be used with m//, s/// and tr///, which all have different behaviour.
perlmonks.org content © perlmonks.org and Anonymous Monk, McDarren, revdiablo, rinceWind, sh1tn, Thelonius Monk
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03