Linux replace forward slash for hyphen more readable methods

For simple find and replaces these methods all work fine

tr 'foo' 'bar' < file
perl -pe 's/foo/bar/g' file
sed 's/foo/bar/g' file

In my case I want to replace the forward slash with a hyphen. These are the methods I know of. The sed and perl methods become hard to read with the back slashes. Is there a more readable sed and perl method to do this? Is there an awk method to do this? Are there any other methods to do this?

$ echo "07/April/2025" | sed 's/\//-/g'
07-April-2025
$ echo "07/April/2025" | perl -pe 's/\//-/g'
07-April-2025
$ echo "07/April/2025" | tr '/' '-'
07-April-2025

Here's a Ruby one-liner in Ruby, no fluff, no comments:

puts ARGV[0].gsub('/', '-')

Usage:

$ ruby replace_slash.rb "07/April/2025"
07-April-2025

Attention, tr translates (translits) individual characters!
f to b, o to a, o to r. Where o has two targets...

In sed and perl the syntax allows any delimiter after an s command. The following has #

perl -pe 's#foo#bar#g' file
sed 's#foo#bar#g' file

awk has gsub(), and the ERE (extendedRegularExpression) is delimited by either / or ".

awk '{ gsub(/foo/, "bar"); print }' file
awk '{ gsub("foo", "bar"); print }' file

In bash, variables helps to avoid a conflict:

oldstr="a/b/c"
from="b/c"
to="d/e"
newstr=${oldstr//$from/$to}
echo "$newstr"

You can even escape the glob(pattern) matching:

newstr=${oldstr//"$from"/"$to"}

The / characters only need to be escaped because they are the designated separators for the s command. My go-to in this situation is to use % as the separator, because it is much rarer (unlike the / in dates and pathnames), and still has a diagonal line as a reminder of its purpose.

paul: ~ $ echo 'alpha/beta/gamma' | sed 's%/%-%g'
alpha-beta-gamma
paul: ~ $ 

I am adding a reply to my own answer, because for some reason the "edit" option is not available to me on my post of April 9th. The words "designated separators" require a fuller explanation.

I checked the man sed page, and it merely specifies that the substitute command (and the similar transliterate command) are s/regexp/replacement/ and y/source/dest/. This is simply not true. The info sed description has a fuller explanation which specifies that any character can be used to delineate the regexp and replacement text, and that chosen character then needs to be escaped if used in those texts.

The '/' characters may be uniformly replaced by any other single character within any given 's' command. The '/' character (or whatever other character is used in its stead) can appear in the REGEXP or REPLACEMENT only if it is preceded by a '\' character.

So in sed 's%/%-%g', the "designated separator" is % because it immediately follows the s. And it does mean immediately: a space or tab is accepted as a separator here.