Hello,
I searched throught perldoc XML::Xpath and here what it has to say:
--------------------------------------------
      findvalue($path, [$context])

      Returns either a "XML::XPath::Literal", a "XML::XPath::Boolean" or a
      "XML::XPath::Number" object. If the path returns a NodeSet, $node-
      set->to_literal is called automatically for you (and thus a
      "XML::XPath::Literal" is returned). Note that for each of the objects
      stringification is overloaded, so you can just print the value found,
      or manipulate it in the ways you would a normal perl value (e.g. using
      regular expressions).
----------------------------------------------
But I am not able to get the numeric value as return value in following
code snippet.

   123     $loopcount = $mail->findvalue('loopcount')->value();
   124     if($loopcount == 0) {$loopcount = 1};

I get this error when I removed the quotes around findvalue call.

-------------------------------------------
Argument "" isn't numeric in numeric eq (==) at ./gencap.pl line 124.
--------------------------------------------

How do I go about this?

Thanks and Regards,
Manish



On 04/06/2005 09:41 PM, Offer Kaye wrote:
On Apr 6, 2005 5:17 PM, Manish Sapariya wrote:

Hi List,
How do i convert a string variable returned by
some XPath API into a number so that I can
compare it or loop using this number.

I am reading one number from XML and I want to
use it for looping.



In general, conversion from a string to a number is transparent in
Perl. "4" is the same as 4.

HTH,

-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to