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

Add $! into your print and it will show you reason for failure.
unless (cpen (FH, $myhashname)) { print STDERR "Can not open file\"$myhashname\": $!n\n"; exit;}
BTW much more common ideom for doing same thing (opening file and exiting with error in case of failure) is:
open (FH, $myhashname) or die "Can not open file\"$myhashname\": $!";

--
Ilya Martynov (http://martynov.org/)