s/\bgreen\b/mauve/g;

$path =~ s#/usr/bin#/usr/local/bin#;

s/Login: $foo/Login: $bar/g;

($foo = $bar) =~ s/bar/foo/;

$_ = 'abc123xyz';
s/\d+/$&*2/e;                   # yields 'abc246xyz'
s/\d+/sprintf("%5d", $&)/e;     # yields 'abc  246xyz'
s/\w/$& x 2/eg;                 # yields 'aabbcc  224466xxyyzz'

s/([^ ]*) *([^ ]*)/$2 $1/;      # reverse 1st two fields
