@size=stat FILEHANDLE;
$size=$size[7];
Hope this helps ...
Can this file get very big ? If so you may wish to re-consider what you are
doing...
If you are looking for one thing in the file you may wish to look into grep
or egrep ...
#! /usr/local/bin/perl
$found = `egrep '^[0-9]+ bytes sent' archive_ftp.log`;
print "$found\n";
($value)=$found=~/^(\d{1,10}) bytes sent/;
print "$value\n";
where archive_ftp.log looks like
200 Port command ok
150 Data connection open
226 Stor command successful
local: daily.dat.gz remote: Sun1*200110.ja/24
739 bytes sent in 0.016 seconds (46.23 Kbytes/s)
quit
221 Goodbye.
-----Original Message-----
From: Nate Brunson [mailto:[EMAIL PROTECTED]]
Sent: October 25, 2001 14:58
To: [EMAIL PROTECTED]
Subject: read I/O function
ok this is my delema, i am trying to read from this file using:
read(FILEHANDLE, $buffer, $size);
because the file size will be different every time i try to read it
(stuff gets added to it all the time)i wanted to use a variable to
store the file size, but i dont know how to update that variable
with the size of the file everytime the perl file is ran. so my
question is: Is there a function or method of getting the size of
a file, so that i can store the size in a variable??
thanx in advance,
nate.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]