in reply to Problems around Param

I'm not sure this is the help you need. But with that caveat, I'm diving in...

You don't show an example of your output, nor of the data structures (try Data::Dumper).

For a more mundane Perl question, you have:

for my $k (sort @hash_array_keys) { print FILEHANDLE $k, $params{$k}; }

which would print like so:

key1value1 key2value2 key3value3

To fix that -- adding a pipe separator -- try this:

for my $k (sort @hash_array_keys) { print FILEHANDLE "$k|$params{$k}"; }

And it seems you are working too hard to get the keys and values -- try this:

my %params = $q->Var; for my $k (sort keys %params) { print FILEHANDLE "$k|$params{$k}"; }

-QM
--
Quantum Mechanics: The dreams stuff is made of