#!/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