in reply to Adding an entry count for each DB

I would suggest using some sort of nested structure to organize your data. Read all your flatfiles into data structures, then manipulate them in another part of the code. Perhaps even translate them into a structure that you can pass to HTML::Template (look into this, it will make your life easier). Something like this (untested):
sub get_items { my $category = shift; open(DATAFILE,"$catagory.dat") or return undef; my @fields = qw/time name email phone subject data passwd picture pr +iceline/; my @items = (); while (<DATAFILEIN>) { chomp; my %hash = (); @hash{@fields} = split /=/, $_; push @items, \%hash; } return @items; }
Then later in the code you can refer to each element like this:
print $items[$i]{time}; print "There are " . scalar(@items) . " items\n"; # etc..
In this case, the structure is already suitable for HTML::Template. But this way accessing the data is highly logical and much more reusable, with the named attributes, instead of putting everything in a variable name in your while loop. Maintaining the code through changes in your flatfile format will be easier.

blokhead