In a message dated 2/16/2006 10:01:03 A.M. Eastern Standard Time, [EMAIL PROTECTED] writes:
 
> a simple regular _expression_ is needed to eliminate the file extension:
>
> $_="123";
> /(XX)YY/;
> print "$1\n" ; # result: "123";
>
> $_="123.txt";
> /(XX)YY/;
> print "$1\n" ; # result: "123"
>
> $_="123.txt.txt";
> /(XX)YY/;
> print "$1\n" ; # result: "123.txt";
>
> Any suggestions for /(XX)YY/ ? Thanks.
>
>
> [Bullock, Howard A.]
>
> You can use ...
>
> use File::Basename;
 

probably the best approach.  
 
> [DELETED TEXT]
>
> Or
>
> my ($basename) = $_ =~ / ^(.*)\.[^.]+$/;
 

this fails for ``123'' or ``123.''
 
bill walters  
 
 
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to