Wait, actually, i needed more than that. I also needed
sub readcount {
my $filename = shift;
# If the file doesn't already exist, we will
# simply return a count of 0 and let writecount()
# create the file later on.
open my $fh, "< $filename" or return 0;
my $count = <$fh>;
close $fh;
return $count;
}
sub writecount {
my $filename = shift;
my $count = shift;
# If the file doesn't exist, this will create it.
open my $fh, "> $filename" or die "Can't open $filename for write: $
+!\n";
print $fh $count;
close $fh;
}
Thank you very much!