Sorry -- let me try that again ...
Why don't you change your next statement to:
next unless -T "$dir/$file" || /^\./;
-----Original Message-----
From: Shepard, Gregory R [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 27, 2001 3:47 PM
To: [EMAIL PROTECTED]
Subject: Read text files only into a hash
All,
I am trying to read only text files (using the -T test) from a directory
into a hash, and not directories themselves. How do I prevent it from it
reading in directories? This sounds like a basic question and know there is
probably an easy answer... but I can't think of it. Thanks.
@ARGV=$dir;
$directory=shift || '.';
opendir DIR, $directory or die "Can't open directory $directory: $!\n";
my $time_num=10000;
my $hash_num=0;
while ($file = readdir DIR)
{
next if $file=~/^\./;
$dir_file = "$dir/$file" if -T "$dir/$file";
@filespecs = stat("$dir_file");
$filespecs = $filespecs[9].$time_num;
$time_table{"$filespecs"} = "$file";
$time_num++;
}
close DIR;
--
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]
--
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]