my $xpath = ’/root and /root/element1’;
How can you be at both /root and /root/element1 at the same time (and I'm not even sure that 'and' can be used even that way)? Do you mean?:
my $xpath = ’/root | /root/element1’;
Anyway, in your first case, it returns a NodeList object (which will contain no nodes), and in the second case, it returns an empty list (if there were nodes, it would return a list of Node objects)...due to the difference in the scalar vs. list context behavior of findnodes(), as implied in the post above.