in reply to get the errors only for a part of the program

"Subscript" generally means an index into array. In  $keys[$k] = $_;, $k would be the subscript. In other words, expect a little confusion.

You're saying that nothing gets written to STDERR? Are you certain something will be written there? It's possible your program never resulted in a condition where you would write to STDERR.

If you could show us your code, we'd have a better chance of helping you find the problem.