Yep, like brian said. You access hash elements with $hash{"$key"}, $hash("$key") is you trying to access a referenced sub.
Also, go ahead and use "my %fn;" at the top so you know how your variable is scoped, what kind it is, and aren't assigning values to it before you know it exists. It will save you some crying in the future.
Finally, it's a bad idea to name a variable like it's a function. Leaving aside the fact that functions are called subs in perl, it's just confusing.
You're trying to get a hash value, but you are using parens instead of braces. You get:
Change your code to use braces for the single element access to the hash:
to get:
Yep, like brian said. You access hash elements with $hash{"$key"}, $hash("$key") is you trying to access a referenced sub.
Also, go ahead and use "my %fn;" at the top so you know how your variable is scoped, what kind it is, and aren't assigning values to it before you know it exists. It will save you some crying in the future.
Finally, it's a bad idea to name a variable like it's a function. Leaving aside the fact that functions are called subs in perl, it's just confusing.
Thank you both.
Eoin