Don't know if this falls into categories already covered (set of active objects in a class? counting?), but I often find a hash of open filehandles useful. e.g. to divide a big file into several smaller ones, using the distinct values of one of the fields as filenames :
perl -MIO::File -ane '($fds{$F[1]} ||= IO::File->new(">$F[1]"))->print($_)' < bigfile Brian