texuser74 has asked for the wisdom of the Perl Monks concerning the following question:
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'); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with while loop
by GrandFather (Saint) on Aug 01, 2008 at 04:31 UTC | |
by texuser74 (Monk) on Aug 01, 2008 at 04:40 UTC | |
by Anonymous Monk on Aug 01, 2008 at 04:36 UTC | |
|
Re: problem with while loop
by CountZero (Bishop) on Aug 01, 2008 at 05:32 UTC | |
|
Re: problem with while loop
by Anonymous Monk on Aug 01, 2008 at 04:14 UTC | |
by Anonymous Monk on Aug 01, 2008 at 04:19 UTC | |
|
Re: problem with while loop
by GrandFather (Saint) on Aug 01, 2008 at 04:17 UTC | |
|
Re: problem with while loop
by Anonymous Monk on Aug 01, 2008 at 04:18 UTC | |
by texuser74 (Monk) on Aug 01, 2008 at 04:34 UTC | |
|
Re: problem with while loop
by Anonymous Monk on Aug 01, 2008 at 04:10 UTC |