#!/usr/bin/perl print "Content-type: text/html\n\n"; open (TXTFILE, "Searches.dat"); @lines = ; close(TXTFILE); chomp(@lines); my %seen_hash; my $key_nums =0; foreach $line(@lines){ @data = split(/\|/, $line); push(@searches, $data[0]); } foreach (@searches) { $seen_hash{$_}++; } my @sorted_keys = sort { $seen_hash{ $b } <=> $seen_hash{ $a } } keys %seen_hash; print ""; # then just do a print for each key in the %seen_hash hash $rows = 0; foreach(@sorted_keys){ if ($rows<5){ print "\n"; } $rows++; } print "
" . $_ . "" . $seen_hash{$_} . "
"; Data -------- search|ip address|time stamp search|ip address|time stamp search2|ip address|time stamp