... or you could split the strings into an array on the directory separators, and join them back together, using only the third and fourth entries:
#!/usr/bin/perl -wl
while (<DATA>) {
chomp;
print join ( '/', ( split ( '/', $_ ) )[ 3, 4 ] );
}
exit;
__DATA__
/mydirectory/directory/test/z2.htm
/mydirectory/directory/other/testhere.htm
/mydirectory/directory/test/dir/z6.htm
Of course, I'm sure there's a nicer way of being able to specify "from the third entry onwards", but I was never very good with arrays.
--
bowling trophy thieves, die!