- or download this
DB<32> p "hello" =~ s/o*$/O/gr;
hellOO
DB<33> $_="hello"; s/o*$/O/g; print # for older Perls
hellOO
DB<34>
- or download this
DB<41> $_="hello"; say pos,"($1)" while m/(o*$)/g; # pos doesn't c
+hange
5(o)
...
DB<42> p "hello" =~ s/x*$/O/gr; # empty match (
+no x)
helloO
- or download this
DB<44> p "hello\nfoo" =~ s/o*\n/O/gmr;
hellOfoo
DB<45> p "hello\nfoo\n" =~ s/o*\n/O/gmr; # added \n at the end of
+ input
hellOfO
DB<46>
- or download this
DB<59> p "12345" =~ s/x*/ /gmr;
1 2 3 4 5
DB<60>