in reply to Stripping parts of paths from directory names

I am going to take a different aproach than every one else, although a did see how %ENV can be very helpfully.

Warning: Apache Head Talking
Traditionally, web servers allow users to host web 'sites' by giving them a directory that is publicly accessible, usually named 'public_html' - looks like yours is called 'web'. I am going to assume the rest (fingers crossed).

What I don't understand is why you want to use the tr/// or even the s/// operators (or substr or split . . .) to derive the two paths. There is nothing wrong with simply 'hard coding' this kind of data - it's not difficult to change, and you don't need to waste CPU time (albeit extremely minimal) doing it.

For example, you know that the disk path is:

$disk_path = '/home/sites/site18/users/rjoseph/web/';
and the URL path is probably:
$url_path = 'http://www.your_box.com/~rjoseph/';
Notice that 'web' is not included, and a tilde is added to the user name.

If you wanted to make this portable across different users of the same box, grab the user's name from %ENV:

$disk_path = '/home/sites/site18/users/' . $ENV{USER} . '/web/'; $url_path = 'http://www.your_box.com/~' . $ENV{USER} . '/';
You can always get to the images by using:
$img_path = $url_path . 'images/';

And by no means am I saying that you should disregard what everybody before me posted. On the contrary, they are showing you many different ways of using regular expressions, string operations, and array operations to 'munge' data. Practice them. :)

Jeff

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)