in reply to right use of a hash table

but I never use %M4, I use $M4

$M4 is a scalar, and %M4 is a hash. You are clearly using a hash, but you declare a scalar with my $M4. Use my %M4 instead.