viffer has asked for the wisdom of the Perl Monks concerning the following question:
Hi all
I am trying to obtain a time stamp using File::stat.
I am obtaining values in the array, but when I try and access individual fields they return undef.
returnsmy $filename = "$directory$file"; my @array=stat($filename);
yet when I try and access a value in the array, viaDB<2> x @array 0 File::stat=ARRAY(0x3055e8e4) 0 1638407 1 281494 2 33188 3 1 4 500 5 1231 6 0 7 97900 8 1375400720 9 1375371182 10 1375371182 11 4096 12 192
it returns undef.my $time = $array[9];
I have since found that
does indeed return the value "1375371182"my $time = $array[0][9]
Similarly when using
stat returns undef in all fields.my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime +,$blksize,$blocks) = stat($filename);
I kind of get that it's returned a two dimensional array, but I don't really follow why the code above doesn't appear to work?
hellllp! :)
Thanks Kev
Back to
Seekers of Perl Wisdom