Hi Monks, I have just started using Perl at work to help out with tasks here and there so I am new to this. Recently, I created this script to grab a list of records from a database. It actually works! I'm pretty thrilled.
open (FILE, "userstab.txt") || die "Cannot open file.\n";
open (NEWFILE, ">results.txt") || die "Cannot find or open file for ed
+iting.\n";
while (<FILE>) {
@zapschool = split (/\t/);
if (m/zaps/i) {
print NEWFILE "$zapschool[4]\n";
}
}
close FILE;
close NEWFILE;
This gives me a list of all the entries in a column, but now I need to figure out how to use Perl to go through my new list, results.txt, and create a new list that holds the names and a count of how many times a partcular name appears on the list.
For example, my list contains college and university names. Many of them appear multiple times. I'd like to create a list where each unique record appears only once but with a frequency count of how many times it appears.
Can you offer some guidance on how to proceede? I'm not necessarily looking for finshed code, but more a point in the right direction so I can do it myself. Thank you.