in reply to Explaining =~ and .= operators
Update: Corrected 2nd example. (thanks lidden & bart)
=~ binds a scalar expression to a pattern match, eg:
The period (.) is a concatenation operator. When used in conjunction with = it concatenates the right argument to the left argument. For example..print "Matches!" if "hello" =~ m/he/;
Is the same as..($foo = "hello") .= " world"; # or $foo = "hello"; $foo .= " world";
$foo = "hello world";
Cheers,
Darren :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Explaining =~ and .= operators
by rinceWind (Monsignor) on Apr 04, 2006 at 10:03 UTC | |
by revdiablo (Prior) on Apr 04, 2006 at 16:02 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |