Perl script counter

for more information.



#!/bin/perl

$filehandle = "log/Num";
open (FILE, $filehandle);
while (<FILE>) { $VisitCount = $_; }
close (FILE);

$CompareCount = $VisitCount;

$VisitCount++;
open (FILE, ">$filehandle");
print FILE $VisitCount;
close (FILE);

@compare_digit = split(//,$CompareCount);
@totaldigit = split(//,$VisitCount);

$total_length = @totaldigit;
$compare_length = @compare_digit;

if ($compare_length < $total_length)
 {
  foreach $TMP (@totaldigit) {
   print "<IMG ALT=\"$TMP\" SRC=\"/Images/animated_digits/$TMPan.gif\">";}
 }

else
 {
  $i = 0;
  foreach $T (@totaldigit) {
   if ($T == $compare_digit[$i]) {
    print "<IMG SRC=\"/Images/animated_digits/$totaldigit[$i]\.gif\" ALT=\"$totaldigit[$i]\">"; }
   else {
    print "<IMG SRC=\"/Images/animated_digits/$totaldigit[$i]an\.gif\" ALT=\"$totaldigit[$i]\">"; }
   $i++;
  }
 }