-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm trying to figure out how to use stat. I have the following code:
#!/usr/bin/perl -w
use strict;
my @filenames;
my $processDir = "/usr/bin";
opendir DH, $processDir or die "cannot open $processDir: $!";
foreach my $file (sort(readdir DH)){
push @filenames, $file;
}
closedir DH;
foreach my $filename (@filenames){
next if ($filename =~ /^.$|^..$/);
my $mod_time = (stat($filename))[9];
print $filename . "\n";
print "$mod_time" . "\n";
}
print "There are " . scalar @filenames . " items in the filenames
array.\n";
I've put $mod_time on a seperate line to verify that it is, in fact
causing the error. The value of $filename prints followed by a newline
and then the following error:
Use of uninitialized value in concatenation (.) or string at
./fileAccess.pl line 18.
Is stat() not getting the information from $filename that I'm expecting
it to? How do I use it if not the way I'm trying?
Mathew
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFE41rr7cEqtYW7kARAvDkAJ9K5syQ0mZkFZYulnlbQF05ok19aQCgx60n
+KC/UqXLH7Qz+MBUrM/AZOI=
=KGit
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>