int(rand() + 1), int(rand()) +1, and hashes
Eugene Tsyrklevich
eugene at securityarchitects.com
Sun Jul 16 02:55:16 CDT 2000
~sdpm~
> bash-2.03# perl -wle 'use Devel::Peek; $a=5; Dump($a)'
> SV = IV(0xf40c) at 0x6f18
> REFCNT = 1
> FLAGS = (IOK,pIOK)
> IV = 5
> bash-2.03# perl -wle 'use Devel::Peek; $a="5"; Dump($a)'
> SV = PV(0x640c) at 0x6f18
> REFCNT = 1
> FLAGS = (POK,pPOK)
> PV = 0x50a0 "5"\0
> CUR = 1
> LEN = 2
> bash-2.03# perl -wle 'use Devel::Peek; $h{1.005}=1; Dump +(keys %h)[0]'
> SV = PV(0x640c) at 0x6ee8
> REFCNT = 1
> FLAGS = (TEMP,POK,pPOK)
> PV = 0x5c20 "1.005"\0
> CUR = 5
> LEN = 6
> bash-2.03# perl -wle 'use Devel::Peek; $h{1.005}=1; Dump +(values %h)[0]'
> SV = IV(0xf404) at 0x6ee8
> REFCNT = 1
> FLAGS = (TEMP,IOK,pIOK)
> IV = 1
to make sense out of the above check out
man perlguts
here is another example that might help (or confuse you even more :)
bash-2.03# cat a.pl
#!/usr/bin/perl
$a=5;
$a=5.0;
$a="5";
bash-2.03# perl -MO=Terse a.pl
a.pl syntax OK
LISTOP (0xea80) pp_leave
OP (0x92260) pp_enter
COP (0xea40) pp_nextstate
BINOP (0x10260) pp_sassign
SVOP (0x10240) pp_const IV (0x61c8) 5 <- int value
UNOP (0x10220) pp_null [15]
GVOP (0x101e0) pp_gvsv GV (0x6f78) *a
COP (0xeac0) pp_nextstate
BINOP (0x102e0) pp_sassign
SVOP (0x102c0) pp_const NV (0x6f18) 5 <- floating point value
UNOP (0x102a0) pp_null [15]
GVOP (0x10280) pp_gvsv GV (0x6f78) *a
COP (0xeb00) pp_nextstate
BINOP (0x857a0) pp_sassign
SVOP (0x210e0) pp_const PV (0x6f00) "5" <- string value
UNOP (0x4380) pp_null [15]
GVOP (0x10320) pp_gvsv GV (0x6f78) *a
comments starting with <- were added by me
hth,
eugene
~sdpm~
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:
unsubscribe san-diego-pm-list
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
mailing list