http://www.perlmonks.org?node_id=178298


in reply to Re: Re: search =~ for /'s
in thread search =~ for /'s

since file url's (like file://c:\test) also work with forward slashses instead of backslashes (file://c:/test/), how about simply replacing all backslashes with a forward slash, and then use the same regex that has been provided by caedes:
$new =~ s/\\/\//g; $new =~ s/([^\/])$/$1\//;