Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Not bad.. I was playing with bdecode/bencode recently (implemented them in elisp, fun) ..
A comment or two: Your code actually only encodes/decodes lists and dictionaries, it will completely ignore single values, eg it wont parse "4:spam" at all. You also have the string/integer parsing code in there twice. You can solve both of these in one go by making the main if (substr(${$dictref},0,1) eq "d") { statement also do strings and integers, and recursing when encountering these inside the dictionary/hash, instead of parsing them on the spot. Ditto the encoding. Pretty nifty all the same :) C. In reply to Re: serialise/unserialising data structures
by castaway
|
|