in reply to Cutting of Path

Well, it should be easier to do it this way:
$files[$i] =~ m#^$conf{rootdir}/(.*)$#; # use alternate regex delimit +ers to avoid confusion $files[$i] = $1;
Assuming that $files$i will only contain a path name. Your method is trying to match (word.word), which will obviously fail if there are sub dirs.
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

Replies are listed 'Best First'.
(tye)Re: Cutting of Path
by tye (Sage) on Mar 21, 2001 at 03:44 UTC

    If you want to match a literal string in a regex, then you really need to use \Q and \E: $files[$i] =~ m#^\Q$conf{rootdir}\E/(.*)$#;

    That code can still fail on quite a few platforms (including the one used by the author of the original question).

    You would probably be better off to use File::Spec for this kind of stuff (though it requires Perl 5.6, unfortunately).

            - tye (but my friends call me "Tye")
      How about this low-tech solution? Since the rootdir is at the start of the string...
      substr($files[$i], 0, length($conf{rootdir})+1) = '';
      buckaduck

      UPDATE: I added 1 to the length to deal with the extra forward slash character...

Re: Re: Cutting of Path
by HTTP-404 (Sexton) on Mar 21, 2001 at 02:28 UTC
    wow guys ur fast as hell
      this one works very nice /^$conf{rootdir}(.*)$/

        Try it with $conf{rootdir}= "c:\\base\\root.web";

                - tye (but my friends call me "Tye")