limva
asked on
NEED HELP WITH GETTING FILE DATE
I'm trying to get the modified date of a file. This is my test code:
<-- Start Code -->
#!/usr/bin/perl
use File::stat;
open(OUTFILE,">test.dat");
($dev,$ino,$mode,$nlink,$u id,$gid,$r dev,$size,
$atime,$mtime,$ctime,$blks ize,$block s)
= stat("test.dat");
print OUTFILE $mtime;
close(OUTFILE);
<-- End Code -->
Only $dev gives me some data, which is "ARRAY(0x815596c)". The rest of the variables give me nothing.
What am I doing wrong?
<-- Start Code -->
#!/usr/bin/perl
use File::stat;
open(OUTFILE,">test.dat");
($dev,$ino,$mode,$nlink,$u
$atime,$mtime,$ctime,$blks
= stat("test.dat");
print OUTFILE $mtime;
close(OUTFILE);
<-- End Code -->
Only $dev gives me some data, which is "ARRAY(0x815596c)". The rest of the variables give me nothing.
What am I doing wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I removed "use File::stat;" and it worked!
Thanks guys!
Thanks guys!
#!/usr/bin/perl
use File::stat;
open(OUTFILE,">test.dat");
($dev,$ino,$mode,$nlink,$u
$atime,$mtime,$ctime,$blks
= stat("test.dat");
print OUTFILE $dev[9];
close(OUTFILE);