go ahead... be a heretic | |
PerlMonks |
Re: Quick and dirty counterby CharlesClarkson (Curate) |
on Jan 21, 2002 at 13:51 UTC ( [id://140357]=note: print w/replies, xml ) | Need Help?? |
A text file should end with a newline. Your code expects it, that's why you are using chomp. print OUTFILE "pagecounter\n$Counter"; should be:print OUTFILE "pagecounter\n$Counter\n"; Also, you should check open for success. Generally this is done with die: Finally, you don't need the while block. If you know the count will always be on the second line: and:
Assuming you keep ignoring the warnings merlyn mentions above. HTH, Charles K. Clarkson
In Section
Cool Uses for Perl
|
|