[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Easy regex?



At 5:32 PM +0100 12/17/98, Scott, Lachlan wrote:
>	Hi All
>
>	I want a directory path to the directory the script is in, but the
>env. var. SCRIPT_NAME returns a path with the file name on the end so I
>wonder if someone can help with an easy regex, (or maybe suggest a method
>that'll return the directory)  to truncate a directory path by chopping off
>the filename at the end, eg
>
>> $orig_path =
>> "server.mydomain.de/directory1/directory2/irritating_filename.pl";
>>
>> and I want
>>
>> $desired_path ="server.mydomain.de/directory1/directory2/";
>>
>> the number of directories and their names is variable; the name and of the
>> irritating file and the length of it's name may change, but for the time
>> being assume *.pl

No reason to bother with *.pl or anything like that.  If it's *really* a
unix path, just split on "/", drop the last item, and join.

-Jeff Lowrey



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch