#!/usr/bin/env perl use utf8; use Utils; use strict; use warnings; MAIN: { binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); binmode(STDIN, ":utf8"); my $s = "Four score and seven years ago..."; print "Replace First 1: ", $s =~ s/\.\.\./!!!/r, "\n"; print "Replace First 2: ", $s =~ s/\b...\b/???/r, "\n"; print "Replace First 3: ", $s =~ s/b.d/???/r, "\n"; print "Replace First 4: ", $s =~ s/(\w+) (\w+)/$2 $1/r, "\n"; print "Replace All 1: ", $s =~ s/\b...\b/???/gr, "\n"; print "Replace All 2: ", $s =~ s/(\w+) (\w+)/$2 $1/gr, "\n"; }