On Thu, 10 Oct 2002, Toby Stuart wrote:

> given that you are passing a file path you could use File::Basename
> 
> eg.
> 
> <snip>
> use strict;
> 
> use File::Basename;
> 
> my $file =
> 'M:\jav_test\Technical_Docs\.@@\main\int_1_2b\techdoc_1_2b\2\Common_Controls
> \main\int_1_2b\techdoc_1_2b\1\Code_Examples\main\int_1_2b\techdoc_1_2b\2\Ext
> ernalID\main\int_1_2b\techdoc_1_2b\1\GetDateofBirth\main\int_1_2b\techdoc_1_
> 2b\1\EnternalID_GetDateofBirth.vbp@@';
> 
> my $name = basename($file);
> 
> $name =~ s/@+$//g;

You will have to escape the @ and you don't need the /g modifier
This can be written as
(my $name = basename($file)) =~ s/\@+$//;

> this seems a bit bodgy but i thought i'd offer it anyway.  someone will
> probably knock up a regex that is better.

There is nothing wrong if this is done in two statements. Your approach
is correct, maybe your regex is a little off :-)




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to