use strict; use warnings; use lib 'C:\Users\Peter\Tools\BuildManager'; my $data = <)) { chomp $line; my ($start, $end, $avg) = split ' ', $line; $dataLU{$_}{sum} += $avg for $start .. $end; ++$dataLU{$_}{count} for $start .. $end; } close $dataIn; open my $markersIn, '<', \$markers; while (defined (my $line = <$markersIn>)) { chomp $line; next if ! length $line; if (! exists $dataLU{$line}) { print "No value for $line\n"; next; } printf "Marker $line: %f\n", $dataLU{$line}{sum} / $dataLU{$line}{count}; } close $markersIn;