in reply to removing a character from a string

Or if you are truly only looking to get rid of "-":
my $foo = '123-4567'; $foo =~ tr/-//d; # tr is specifically for the replacement # of single characters, the "d" tells it # to remove any characters for which # is no translation provided. print $foo;