Three things:
- you say you're reading from a file, yet you're getting your input from '<>', which is stdin. that might be why you're not getting any data
- you're using 'fixed-width' files, yet you're expecting each line to end in a newline. If 'fixed-width' == record based, then you should be doing a read($buffer, $record_length) and doing the regex on $buffer
- the best way to pass data between subs is to pass arguments. Globals are evil (tm). The first line of get_domcf should be something like my $key = shift; and you should call get_domcf like so get_domcf($key)
I think if you sort these bits out, you'll fix your problem :-)