alias ts='perl -v | grep "This is"; \
perl -e"use XML::Twig; \
print qq{XML::Twig: \$XML::Twig::VERSION\n}"; \
perl -e"use XML::Parser; \
print qq{XML::Parser: \$XML::Parser::VERSION\n}"; \
xmlwf -v;'
####
This is perl, v5.6.1 built for i686-linux
XML::Twig: 3.09
XML::Parser: 2.31
xmlwf using expat_1.95.5
####
#!/usr/bin/perl -w
use strict;
use XML::Twig;
sub Node {
my ($twig, $node) = @_;
my $txt = $node->text ();
my $id = $node->att ('id');
#print two strings individually
print "$id\n";
print "$txt\n";
#print list - OK
print "1) list: ", $id, " ", $txt, "\n";
#print with string concat - still OK
print "2) concat: $id $txt\n";
#the concatenated string DOES match the Latin1 part
my $res = "$id $txt" =~ /$txt/ ? "match" : "NO match";
print "\"$id $txt\" =~ /$txt/ => $res\n";
}
package main;
my $twig = XML::Twig->new (KeepEncoding => 1, TwigHandlers => {Node => \&Node});
$twig->parse (\*DATA);
__DATA__
fünfzig