Scott wrote:
> 
> 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?


my @tagandtxt;

while ( <*.tag> ) {
    ( my $file = $_ ) =~ s/\.tag$//;
    push @tagandtxt, $file if -e "$file.txt";
# or if you want all the file names in the array
#   push @tagandtxt, "$file.tag", "$file.txt" if -e "$file.txt";
    }



John
-- 
use Perl;
program
fulfillment

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

Reply via email to