in reply to prune xml of empty elements
Output :use Modern::Perl; my $str = qq@ <note> <to> <person>Satan</person> </to> <from via="postcard" russia="with love">moneypenny</from> <heading></heading> <body></body> </note>@; $str =~ s@<(.*?)></\1>@@g; say $str;
No modules or parsing needed, just a simple one line regex.<note> <to> <person>Satan</person> </to> <from via="postcard" russia="with love">moneypenny</from> </note>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: prune xml of empty elements
by chromatic (Archbishop) on Jul 15, 2011 at 06:39 UTC | |
|
Re^2: prune xml of empty elements
by happy.barney (Friar) on Jul 15, 2011 at 07:36 UTC | |
|
Re^2: prune xml of empty elements
by jdporter (Paladin) on Jul 15, 2011 at 02:46 UTC |