#!/usr/bin/perl use strict; use warnings; my $string = '\\w'; $string =~ s/(\\)+/\\/g; print $string;