in reply to Search & Replace repeating characters

The most readable solution (at least for me) uses just two regexes, the first one shrinks the backslashes and replaces them with slahses, the second one removes the trailing slashes:
my $script_dir = 'C:\\temp\\\\'; print "1. $script_dir\n"; $script_dir =~ s{\\+}{/}g; print "2. $script_dir\n"; $script_dir =~ s{/$}{}g; print "2. $script_dir\n";

You can use transliteration with shrinking instead of substitution in the first step:

$script_dir =~ tr{\\}{/}s;

It's also possible to do everything in one step, but we're entering a golf course here:

$script_dir =~ s{\\+(?=(.)?)}{"/"x defined $1}ge;
Update: Talking about golf, this is shorter:
$_ = s/\\+$//r =~ s{\\+}{/}gr for $script_dir;

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]