If I'm reading this correctly, try:
foreach (<LOGFILE>) {
@fields = split '*', $_;
# ... blah, blah, blah ...
}
as for the counting... not sure I follow. If you're trying to count the number of times a specific value shows up in a field (i.e., number of times "company abc", "company xyz", etc. show up in the "company name" field) then perhaps something like:
%company_count;
foreach (<LOGFILE>) {
($company_name, ...) = split '*', $_;
$company_count{$company_name} ++;
}
# foreach sort (keys %company_count) {
foreach (sort keys %company_count) {
print $_, " showed up ", $company_count{$_}, " times\n";
}
fits the bill... |