you should be locking and unlocking the File::CounterFile object, not the class.
## File::CounterFile->lock();
## should be
$counter->lock();
$counter->inc;
## File::CounterFIle->unlock();
## should be
$counter->unlock();
i haven't tested, but this looks like the likely problem. the error message stems from the fact that a File::CounterFile object is a blessed hash reference, so perl is trying to use the string 'File::CounterFlie' as a reference to the object (a hash reference.)
~Particle *accelerates*