Try:

$tarFile =~ s/^(\w+)\.tar$/$1/;

Troy

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Purcell, Scott
Sent: Thursday, April 19, 2001 1:32 PM
To: '[EMAIL PROTECTED]'
Subject: $1 question


Hello,
I don't know why I can't ever do this, but I know I have seen what I am
trying to accomplish done in one line.

I have a line that looks like the following:
my $tarFile = 1234567_six12.tar
And I want to strip off the '.tar'

So I know I can catch everything up to the first '.' in a ()
$tarFile =~ s/^(\w+)\./$1/;
print "$tarFile; gives me 1234567_six12tar, it just removes the period?

What the heck am I doing wrong today? Any ideas? Or does this have to be
done on two lines like my next eg. which works.

$tarFile =~ s/^(\w+)\./$1/;
my $tmpGoodFile = $1;

That just doesn't seem proper to me.

Thanks
Scott Purcell

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to