in reply to search =~ for /'s

$new =~ s/([^\/])$/$1\//;
You shouldn't worry about the backslash if $new is a URL because URl's don't end in backslashes. :-)

-caedes

Replies are listed 'Best First'.
Re: Re: search =~ for /'s
by BrowserUk (Patriarch) on Jun 29, 2002 at 23:21 UTC

    Does file://c:\ qualify as a url?

      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\//;
      Good question...

      -caedes