[EMAIL PROTECTED] wrote:

> 
> Hello,
> 
> 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.

I'd probably do it the easy way and just remove the ext:

(my $file = $_) =~ s/\.[^.]*$//;
print "$file\n";
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to