in reply to Stripping parts of paths from directory names
instead of this:$file_path =~ s#^$path##;
(heck, you could even do this, if you were in a silly mood:eval "$file_path =~ tr/$path//";
but I don't know that I'd recommend it)($file_path) = split /$path/, $file_path, 1;
but you might want to look in CPAN for better solutions to your underlying problem--they're out there.
By the way, you'll note that I used # instead of / for my separator--I almost always do that, especially when I've got lots of slashes in my pattern, as it makes it easier to see what's going on.
Update: I fixed some typos and stuff I didn't like.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Stripping parts of paths from directory names
by repson (Chaplain) on Jan 06, 2001 at 13:56 UTC |