#! /usr/bin/perl use strict; use warnings; #GLOBALS my $DEBUG=1; # 0 no debug messages, 1 light logging, >1 lots of logging my (@FH,$TOTALS); for my $index (0..$#ARGV){ open ($FH[$index],"<","$ARGV[$index]")||die "cant open $ARGV[$index] $!\n"; print "assigned ",$index-1," to $ARGV[$index]\n if $DEBUG;"; } open($TOTALS ,">","totals.csv"); while (<{$FH[0]}>){ chomp; print "Current record is |$_|" if $DEBUG; my @totals=split; #space seperated for my $FH (@FH[1..$#FH]){ my $record=readline($FH)||warn "cannot read file $!\n"; chomp($record); print "$record\n" if ($DEBUG>1); my @record=split(/ +/,$record); $totals[1]+=$record[1];#total read volume $totals[2]+=$record[2];#total write volume $totals[3]=$record[3] if $totals[3]<$record[3];#Return max response time $totals[4]=$record[4] if $totals[4]<$record[4];#Return max % waiting $totals[5]=$record[5] if $totals[5]<$record[5];#Return max % blocked $totals[6]+=$record[6]; # total errors $totals[7]+=$record[7]; # total errors $totals[8]+=$record[8]; # total errors $totals[9]+=$record[9]; # total errors $totals[10]+=$record[10]; # total errors $totals[11]+=$record[11]; # total errors print "totalling record $record[0] for $#FH files\n" if $DEBUG; } print $TOTALS "@totals\n"; }