Chances are that the file size will never equal exactly 500 bytes. You could 
use >= instead of eq, and it should work. Also, you don't have to close 
STDERR before reopening it, and in cases where you want to do numeric 
comparisons, use == instead of eq. Hope that helps a little. Also, it might 
be better to use an until loop, unless you wanted to do no more than 30 
iterations. Indentation is good too.

On Tuesday 04 October 2005 09:55, Umesh T G wrote:
> Hello List,
>
> #!/usr/bin/perl
>
> close(STDERR);
>
> open(STDERR,">/tmp/test.log") or die " Can't do it!!";
>
> for($i=0; $i <=30; $i++) {
> print STDERR "print something in the file.\n";
> ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize
>,$blocks) = stat(STDERR);
> if ( $size eq '500' ) {
> exit(0);
> }
> }
>
> I want this file not to grow more than 50KB.
> How can I go about it. I been stuck here.. this above script will not do
> the needful
>
> Thanks in advance,
>
> Cheers,
> Umesh

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


Reply via email to