develooper Front page | perl.beginners | Postings from December 2002

RE: Using while ( -e $file )

December 26, 2002 19:10
RE: Using while ( -e $file )
Message ID:

Seems like removing the quotes from 
TEMPFILE and SIZE did the trick.
Thanks Kipp and Paul. 
If anyone wants the full sub leme know off-list. 


-----Original Message-----
From: Scot []
Sent: Thursday, December 26, 2002 4:32 PM
To: Beginners Perl
Subject: Using while ( -e $file ) 


 Trying to write a file monitor for temp files using a while loop. 
The problem is that the file test does not seem to be re-evaulated 
each loop. If I delete the file after the loop has started it 
drops into the. SHRUNK test. I would think it would drop out of the 
while loop.  
while ( -e $tfile ) { 
      $SIZE = (-s "$TEMPFILE") /1024;
      if ( $SIZE > $PSIZE ) {
         print "$TEMPFILE Size = $SIZE Kb\n";
      } elsif ( $SIZE < $PSIZE ) {
         print "$TEMPFILE SHRUNK! from $PSIZE to $SIZE  Kb\n";

To unsubscribe, e-mail:
For additional commands, e-mail: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About