lomSpace, Beyond your question, you seem to be doing some odd stuff.
When you say my @maid_id = split(/_/, $komp_dir);, do you really mean to split $komp_dir? That variable is unchanging within both loops, and so should certainly not be reprocessed with every pass. Ditto for the other variables in the nested loop.
The next line has another problem: my $maid = $fields[0]; Don't you mean my $maid = $maid_id[0];?
Your braces in ${maid} are unnecessary and inconsistent with, say, $count.