|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Re: XML::Twig - trying to simplify syntaxby merlyn (Sage) |
| on Nov 12, 2010 at 01:27 UTC ( [id://870966]=note: print w/replies, xml ) | Need Help?? |
|
The problem is that your ... ($my_xpath)[0] ... is being interpreted as ... ($my_xpath)->[0] .... As in, the thing on the left is expected to be an arrayref, which it isn't.
You can use a slice to get the proper effect: That'll provide list context to the inner expression, and then extract just the 0'th element from that. -- Randal L. Schwartz, Perl hacker The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||