Anyway, this is what you can do if you can't help yourself.
- use Fcntl ':flock';
+ use Fcntl qw(:DEFAULT :flock);
sysopen(FH, "numfile", O_RDWR|O_CREAT) or die "can't open numfile: $!";
flock(FH, LOCK_EX) or die "can't flock numfile: $!";
$num = <FH> || 0;
You should think long and hard about why you need everything loaded
at once. It's just not a scalable solution. You might also find it
-more fun to use the the standard DB_File module's $DB_RECNO bindings,
+more fun to use the standard DB_File module's $DB_RECNO bindings,
which allow you to tie an array to a file so that accessing an element
the array actually accesses the corresponding line in the file.