Am Mittwoch, 6. April 2005 18.02 schrieb [EMAIL PROTECTED]:
> ----- Original Message -----
> From: Manish Sapariya <[EMAIL PROTECTED]>
> Date: Wednesday, April 6, 2005 10:17 am
> Subject: Converting a retruned string value to a number
>
> > Hi List,
>
> HellO,
>
> > 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.
>
> You should not need to convert, Perl is smart enough to figure it out on
> it's own.

...and therefore...

> #!PERL
> use warnings;
> use strict;
>
> my $te="123";
> print $te if $te eq "123" && $te == 123;

...it's sufficient to compare numerical, which is more performant (I think):

print $te if $te == 123;

 :-)

(but your code won't produce a warning in the case that $te's value is not 
numeric)

[...]

-- 
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