# Get current file name $filename = __FILE__; # get old UID stored after __END__ $uid = ; chomp($uid); print "This script has been run $uid times $/"; # increment UID $uid++; # open current running file open(THIS_IN, $filename) or die "Could not open file"; @code = ; close (THIS_IN); # Store new UID in last line of this code $size = @code; @code[$size-1]=$uid; # open current running file open(THIS_OUT,"> $filename") or die "Could not output to file"; print THIS_OUT @code; close (THIS_OUT); __END__ 0