Chas. Owens wrote:
On Feb 11, 2008 4:17 PM, Michael Barnes <[EMAIL PROTECTED]> wrote:
I thought about using lstat to get the size of a file for file
comparisons. I see that lstat always returns a list of thirteen values.
The references I find appear to require assignment of those 13 values
to variables, even though I only want to use one.
Do I really have to put
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= lstat($filename);
Just to get the $size variable populated with the file size?
My ultimate goal is to check the size of huge files copied to a folder.
Once I get the $size to come back the same three times in a row,
indicating the file is all there, then I can move on with playing with
the file.
snip
The lstat function returns a list, so you can use the splice operator on it:
The splice operator only works on arrays, not lists.
my $size = (lstat $filename)[7];
That is an axample of a list *slice*.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/