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.
my $filename = "$directory$file";
my @array=stat($filename);
returns
DB<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
yet when I try and access a value in the array, via
my $time = $array[9];
it returns undef.
I have since found that
my $time = $array[0][9]
does indeed return the value "1375371182"
Similarly when using
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime
+,$blksize,$blocks) = stat($filename);
stat returns undef in all fields.
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.