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:

my $size = (lstat $filename)[7];

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to