as a result of a web form. Now, is it possible to get this data out in a "csv" format having in mind that number of records can differ which means that "x" in last part (PRIx, FORx, DOLx, CMGx, MEXx) will increase depending on how many UIDs there are ?
I've tried with following :

For your problem, you may either add a the number of available UIDs in your data-structure (and use it like the $max in the example above), or you might check with exists whether a specific UID-entry is present in your hash (e.g. if (exists($e{"MEX$nr"}) { ... })
HTH, Rata

This puzzles me slightly, because it appears to just be a POST data-stream which any of several CGI-handling packages already know how to handle. But, nevertheless, the so-called “auto-vivification” features of Perl make such things much easier than what you seem to be doing here. Consider the following one-liner:

merely by using a key {'foo'}, Perl causes $foo to automatically become defined as a hash. (Notice how in this case it was undef before.)

Merely by using a key that had not been used before, Perl causes a new hash-bucket ($$foo{'bar'} or if you prefer $foo->{'bar'}) to appear.

Using the bucket as an array @{...} causes it to be an array, initially empty, to which we in this example push the arbitrary value 3.

Perl has, in short, followed its usual practice of “do what I mean.”

You could, therefore, simply loop through the set of keyword=value pairs, and push a value into a bucket for that keyword, trusting auto-vivification to automagically make those elements properly for you. (Perhaps you also use: next unless defined($value); ... in that loop.) Welcome to “The Swiss Army® Knife of Data Processing.”

If duplicates are a possibility and considered to be a problem, auto-vivification can be used just as easily to make a hash of hashes, e.g.$$foo{$keyword}{$value} = 1; or something similar. In any case, Perl allows you to achieve the desired results with a paucity of code.

As you parse the file one line at a time and come to CMG1=Ja, the string CMG1 is your keyword and Ja is the associated value. If you needed to know that it was in the twelfth position, then you could for example set up a hash-of-hashes data structure such that $hoh->{'CMG1'}{'Ja'} = 12. Or whatever else suits your fancy. My key point was that, with auto-vivification, you can establish such data structures very easily. You refer to an unassigned variable as a hash ... and it is a hash. You execute as an assignment-statement what I wrote just above, and the desired hash-of-hash element simply appears. $hoh->{'CMG1'} exists, and it has a key {'Ja'}, and that key has the value 12. Presto. Arrays work the same way. It’s entirely up to you to determine what structure you want, but very easy to get it.

You have to tell Dumper that the element is an array-reference. Otherwise, it will “flatten” the list for printout and dummy up those $VARn pseudo-names within Dumper’s own output. But it’s only for its own printing purposes: those names do not actually exist anywhere.