in reply to period in strings

The issue is not the period, per se, but that the nested hash structure is uninitialized for either $key->{'att'}->{'for'} or $key->{'att'}->{'yfiles.type'}. I would suggest you use Data::Dumper to examine your @keys structure before you reach the loop to see if the data content matches your expectations. Inserting the following before your foreach loop should suffice:

use Data::Dumper; print Dumper \@keys;

On a side note, please wrap posted code in <code> tags to maintain formatting, as per Writeup Formatting Tips or Markup in the Monastery. And welcome to the Monastery.