in reply to right use of a hash table

You're referring to %M4 on this line:

$M4{$target} = $M4{$target} + $M4_compteur{$target};
and this one
$M4{$target} = $M4{$target}/$Duration;
but declare only $M4, on this line:
my $M4;

It appears you are doing the same thing with the variable $M4_compteur.

Try changing

my $M4; my $M4_compteur;

to

my %M4; my %M4_compteur;

The sigils ($, %, &, *, @) are important. I also find them slightly confusing, as $this, %this, @this, and &this are completely distinct, but the elements of %this and @this are referenced as $this{one} and $this$one. To ease my confusion, I tend to avoid giving scalars, arrays, hashes, and functions names that are the same or too similar.


emc

Information about American English usage here and here.

Any New York City or Connecticut area jobs? I'm currently unemployed.