IanW wrote:
>
> "Jürgen Exner" <> wrote in message
> news:XoRdi.7443$u65.1117@trndny07...
>
>> It might be easier to use Data:
umper to convert the hash into a textual
>> representation that can readily loaded into perl again
>
> Hi Jue
>
> Thanks for the reply.
>
> If I understand it correctly, doesn't Data:
umper just convert the hash
> into a string representing the hashes structure? In which case, if I tried
> to pass that via the command line, the spaces (amongst some other
> characters like double quotes) would cause probs when the string is pulled
> into @ARGV at the receiving script?
>
> Eg:
>
> use Data:
umper;
> my $d = Dumper(\%data);
> my $result = `perl z:/interface.pl $d`;
>
> That would result in only $ARGV[0] only containing "$VAR1". One could put
> $d in double quotes, but if there were double quotes in one of the hash
> values then it would presumably mess things up again.
>
> Regards
> Ian
I think there is a simple point being missed here.
Why not use Data:

umper to serialise the data (because that's what it
does), print the result to STDOUT, have the called program read it in from
STDIN to a scalar, then eval the scalar.
In other words, pipe the serialised version of the hash between the two
programs. Very much the "unix way" (TM).
Another way to do it would be to use IPC::Shareable and tie the hash to a
blob of shared memory. All that the callee program needs to know is the
shared memory key id which is trivially passed as an argument.
Probably not a lot efficiency wise as the latter method has to serialise the
data anyway, but it's neat, and potentially bi-directional - ie the callee
can modify the data and have the caller see it.
Cheers
Tim