thanks, but in the loop of read input file, "if ($pins1 =~ /^$key$/) ", the dollar sign, $ will have to be removed too. I forget to mention that for the pins/ports name, it has expression like this symbol, [], which means that it cant be cathed when using ur way. This is the only weak point.