my $xx = &log; print "<b>$xx</x>";
sub log { my $log_file = "log.txt"; open(LOGFILE, "$log") or die("Could not open log file."); #my %seen; my %seen = (); my %typeseen = (); # read it in my $test = "Home Company"; while(<LOGFILE>) { next unless /($test)\*(.*?)\*(.*?)\*(.*?)\*(.*?)\*(.*?)\*(.*?)\*(. +*?)$/; my ($item, $logintype) = ($1, $4); #print $item; $seen{$item}++; $typeseen{$item}{$logintype}++; } # dump it out foreach my $item (sort keys %seen) { print "$item:<br>\n"; print "\tLog in activity: ", $seen{$item}, "<br>\n"; foreach my $type (sort keys %{$typeseen{$item}}) { print "\t", $type, " activity: ", $typeseen{$item}{$type}, "<br>\n +"; } } } ####### END SUB LOG
In reply to Re: Re: How to collect the stdout of a subroutine call?
by Anonymous Monk
in thread How to collect the stdout of a subroutine call?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |