in reply to
Re^2: XPath with node names and attributes...
in thread XPath with node names and attributes...
Didn't have a chance to test your example, but I think this is the problem:
$rule_source = "head/node1@attr1";
Perl thinks you want to insert the contents of an array called @attr1 into the string because you used double quotes. Since there is no such array your $rule_source ends up with just "head/node1". Either escape the '@' or use a single quoted string as in the examples below:
$rule_source = "head/node1\@attr1";
$rule_source = 'head/node1@attr1';