Hello,
Thanks for all your replies.

This however does not work for me OR I dont understand
the problem I encountered.

This is the exact error that I encouter when running my
perl code.

--------------
Argument "XML::XPath::Node::Element=REF(0x86c31c8)->findvalue('loo..." isn't 
numeric in numeric eq (==) at ./gencap.pl line 124.
-----------------

The code snippet is

    57 my $doc = XML::XPath-> new(filename=>$specfile);
    58
    59 my @mails = $doc-> findnodes('//mail');
    60
    61 foreach my $mail (@mails) {


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

So is that the value returned by findvalue is not string and something
else.

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