I'm new to Perl, so take this with a grain of salt, but I did it like this:

use strict;
use File::Basename;

my $basename;
my $filename = 'yourfile.tag';
($basename) = fileparse($filename, '\.tag');
print "basename = $basename\n";

# see perldoc File::Basename for more info.  fileparse() can give you the path
and file extension also.

Hope this helps,
Rick

-----Original Message-----
From: Scott [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 08, 2002 8:44 AM
To: [EMAIL PROTECTED]
Subject: file name matching


Morning:

I need to scan a directory for files, they will be in pairs, a .tag file 
and a .txt file.  I need to first make sure the .tag file(s) is there.  If 
it is I need to check for the same prefix .txt file.  Here is what I do to 
check for the file:

($scantag) = <*.tag>;

@files = glob("*.tag");

Is there a way to determine the prefix to the file?  xxxxx.tag and 
xxxxx.txt?

Thanks,

-Scott



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

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

Reply via email to