3 ms·
XML::Twig feels pretty Perl-y and the code isn't significantly different to your example: use XML::Twig; my $twig = XML::Twig->new( twig_handl
by darrenf 5y ago
XML::Twig feels pretty Perl-y and the code isn't significantly different to your example:
use XML::Twig;
my $twig = XML::Twig->new(
twig_handlers => {
'items/item[@color="orange"]' => sub {
$_->set_att(color=>"red")
}
}
)->parse(*STDIN);
$twig->print;
- wruza 5y agoWell, that's pretty identical, this guy knows Perl. But for me it's still hard to continue the search after those two, when you have s///, and stackoverflow is few years in the future. I believe that most Perl programmers felt similar.
- wazoox 5y agoPerlmonks has been around for ages, and until the rise of SO was the definite go-to resource for any question Perl-related. Eons ago, the naive questions about HTML and regexes ( like https://perlmonks.org/?node_id=47553 https://perlmonks.org/?node_id=47553 21 years ago) were replied with "use a proper parser module".