I am using perl, v5.6.1 built for MSWin32 by IndigoSTAR.
When I compile(latex compiler) my test.tex file a test.log will be created. When I do another compilation the log file will get updated. So I need to keep on compiling until my .log file gets stabilized. For this I am copying the .log file to old.log file and comparing their texts before each compilation. But my following perl script is not exiting properly even after .log and old.log are same. Please review my script and give me your suggestions.
Thanks in advanceuse strict; my %logHash; my $ctr=0; my $diff=0; sub compare{ my($log, $olog) = @_; open(XR, "$log")||die; while(<XR>){ $logHash{$_}=1; } close(XR); open(OXR, "$olog")||die; while(<OXR>){ $diff=1 unless defined($logHash{$_}); } close(OXR); return $diff; } system('latex test.tex'); system ("copy test.log test-old.log"); system('latex test.tex'); while(compare("test.log","test-old.log")){ system ("copy test.log test-old.log"); system('latex test.tex'); }
In reply to problem with while loop by texuser74
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |