sebastiannielsen2 has asked for the wisdom of the Perl Monks concerning the following question:
How can I convert a hash (%hash) to a string ($string) such as so ($string) can be converted back to (%hash)?
Im currently designing a milter using Sendmail::PMilter , but the getpriv/setpriv can only store one single value for state tracking across callbacks, so to store "multiple" values into this, I need to collapse the hash into a string, and then expand the string when being used/changed.
I googled and found multiple examples of Data::Dump and Data::Dumper, but that only allows one-way conversion from hash to string, not back again.
Note that the conversion function must be "safe" against anything that can be present in strings and hashes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How can I convert hash to string and back again?
by roboticus (Chancellor) on Mar 02, 2015 at 20:19 UTC | |
|
Re: How can I convert hash to string and back again?
by LanX (Saint) on Mar 02, 2015 at 20:37 UTC | |
by sebastiannielsen2 (Novice) on Mar 02, 2015 at 21:30 UTC | |
by LanX (Saint) on Mar 02, 2015 at 21:41 UTC | |
|
Re: How can I convert hash to string and back again?
by kennethk (Abbot) on Mar 02, 2015 at 20:28 UTC | |
|
Re: How can I convert hash to string and back again?
by Anonymous Monk on Mar 03, 2015 at 00:50 UTC |