> Well, I have no idea why it does what it does, but I can tell you how to make > it work: > s¶3(456)7¶¶$1¶x; > s§3(456)7§§$1§x;
Amazing. Thanks very much. This seems to contradict the documentation. The perlop man page clearly says that there are exactly 4 bracketing delimiters: "()", "[]", "{}", and "<>". Everything else should be non-bracketing. But, in fact, several characters that I have tried behave as bracketing delimiters. An exception seems to be combining characters. The two that I tried don't work as either regular or bracketing delimiters. I have tested this on Perl 5.8.8, 5.10.0, and 5.12.2. See the code below for results. The combining characters appear in the last 2 test pairs. ---------------------------------------------------------------------------------------- #!/usr/bin/perl -w use warnings 'FATAL', 'all'; # Make every warning fatal. use strict; # Require strict checking of variable references, etc. use utf8; # Make Perl interpret the script as UTF-8. my $string = '123456789'; # Initialize a scalar. print "The original string is $string\n"; # $string =~ s%3(456)7%$1%; # Succeeds # $string =~ s%3(456)7%%$1%; # Fails # $string =~ s§3(456)7§$1§; # Fails # $string =~ s§3(456)7§§$1§; # Succeeds # $string =~ s–3(456)7–$1–; # Fails # $string =~ s–3(456)7––$1–; # Succeeds # $string =~ s“3(456)7“$1“; # Fails # $string =~ s“3(456)7““$1“; # Succeeds # $string =~ s‱3(456)7‱$1‱; # Fails # $string =~ s‱3(456)7‱‱$1‱; # Succeeds # $string =~ s⇧3(456)7⇧$1⇧; # Fails # $string =~ s⇧3(456)7⇧⇧$1⇧; # Succeeds # $string =~ s⃠3(456)7⃠$1⃠; # Fails (single U+20e0) # $string =~ s⃠3(456)7⃠⃠$1⃠; # Fails (double U+20e0) # $string =~ s̸3(456)7̸$1̸; # Fails (single U+0338) # $string =~ s̸3(456)7̸̸$1̸; # Fails (double U+0338) # Modify it (uncomment any one line above.) print "The amended string is $string\n"; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/