> Like this? > > $ p6 'my $x="11.2."; my Str $D0; my Str $D1; $x~~m{ (<:N>+) 
> [.] >
(\d+)}; $D0 ~= $0; $D1 ~= $1; print "$D0 $D1\n";' > > 11 2 >

There's an important difference between "$D1 ~= $0" and "$D1 = ~$0".
They only do the same thing if $D0 (and $D1) are empty at that point; if
they have something in them, the result will be the concatenation of
$D0's current content and $0's content (same thing with $D1 and $1).

~= is an operator that is formed as a combination of ~ and "assignment".
"$a ~= $b" does almost the same as "$a = $a ~ $b". it works for every
infix operator, too:

$a += 1 is probably known to many

$a max= 5 will leave $a containing either $a or 5, whichever is higher

$a **= 2 will leave $a with the result of $a ** 2

and so on, and so forth.

Does that clear things up?
  - Timo

Reply via email to