#!/usr/bin/perl

use warnings;
use strict;

# define a variable with name of file
#
my $file = "my-counter.txt";

# open file for reading and use file-handle COUNTER_FILE
#
open(COUNTER_FILE, "$file") or die "Cannot open file $!";

# read contents in variable $counter_value
#
my $counter_value = <COUNTER_FILE>;

close COUNTER_FILE;

## do something with $counter_value;
###

## open file for writing
##
open(COUNTER_FILE, "> $file");

## write counter value to file
print COUNTER_FILE $counter_value; 


close(COUNTER_FILE);

## print the hit counter itself, too.
print "777 hits";
