Michael Barnes 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.
You could use the -s file test operator:
my $size = -s $filename;
But that uses stat() instead of lstat(). If you really need lstat()
then you could do it like this:
lstat $filename;
my $size = -s _;
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/