eugene at securityarchitects.com
Sun Jul 16 12:45:17 CDT 2000
I have a question regarding integer operations. According to
$ perl -wle 'use Devel::Peek; $a=1; $a+=1; Dump($a)'
SV = PVNV(0x31540) at 0x6f24
REFCNT = 1
FLAGS = (NOK,pNOK)
IV = 1
NV = 2
PV = 0
an integer operation '$a += 1;' converts $a to a floating-point type (NV).
I would expect perl to be able to figure out that $a+=1 should produce
an integer result (IV) but obviosuly it doesn't. I have also noticed that
PV type is created as well (with a null value).
After playing with some more examples the only way i could get an IV
value after an arithmetic operation was an explicit cast:
$a = int($i + $i2);
p.s. i am not subscribed to clpm so copy me directly on your response
The posting address is: san-diego-pm-list at hfb.pm.org
List requests should be sent to: majordomo at hfb.pm.org
If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:
If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.
More information about the San-Diego-pm