in reply to How to open sub FH when filename is passed to sub?

I'm surprised it gets that far. Please copy and paste the smallest *exact* code that gives you this error -- there are too many syntax errors and typos here for me to understand what you mean.

My guess is that you're trying to open a file with an undefined name. This means that $myhashname has an undefined value. Looking at your argument passing, you probably mean to say: my $myhashname = shift;.

After that, you're passing two lists, and appear to be attempting to receive them both into two listy variables. That doesn't work -- the first list will slurp up all of the elements. You'll have better luck if you pass references. Reading perlsub and perlreftut may help.