in reply to Out of memory!!??

This regex: /(\w+_meas_.*)/ might not be the best choice if the file is not very uniform, and there are long lines that match the pattern. If you think you know that anything behind the 'meas_' is at most 100 chars, you can use /(\w+_meas_.{0,100})/

If you have some very long lines, that prevents them from being all stored in the hash.

This is not your main problem, but might be a precaution anyway.

As a side not, the if (exists ... code is superfluous, you can just as well increment $CALHASH{$layer}{'freq'} if the entry exists or not.