Perl lets you choose your own quote separators. If you find that you need to use a double quote inside an interpolating string (i.e. "") or a single quote inside a non- interpolating string (i.e. ) '', you can use the quote operator to specify another character that will act as a separator for the string . Separators come in two forms: in square brackets and without fixation. Restrictions in square brackets have different starting and ending symbols: [], {}, (), []and <>. All other characters *are available as non-blocking delimiters.
So your example can be written as
$foo = qq(12."bar bar bar"|three);
"12." (TIMTOWDI). , .
$foo =~ s/^(12[.])/$1../;
^ , () $1, 12 "12", [] . , . , ([]). , . \, , , .
$foo =~ s/^(12\.)/$1../;
- substr. Perl : lvalues. .
substr($foo, 3, 0) = "..";
, "12." , index, , , length, , "12." substr.
Perl script, .
use strict;
use warnings;
my $foo = my $bar = qq(12."bar bar bar"|three);
$foo =~ s/(12[.])/$1../;
my $i = index($bar, "12.") + length "12.";
substr($bar, $i, 0) = "..";
print "foo is $foo\nbar is $bar\n";
* , (, , , , ),