waider: (Default)
waider ([personal profile] waider) wrote2005-10-01 12:33 pm
Entry tags:

evil perl of the day

$out =~ s{<([^>]+)></\1>}{<$1 />}gs;

If you can figure out which switches will make XML::Simple do this automatically, please tell me, as the documentation consists of a terse statement of purpose for each option followed by a short example, neither of which is getting me around this problem.

Which is, obviously, to collapse an XML element <foo></foo> to its compressed form, <foo />.

[identity profile] bitpuddle.livejournal.com 2005-10-01 03:48 pm (UTC)(link)
This doesn't answer your question, but why do you care which form it is in?
ext_181967: (Default)

[identity profile] waider.livejournal.com 2005-10-01 04:28 pm (UTC)(link)
It's one of those "be generous in what you accept and strict in what you produce" situations.