Your use of "is" is incorrect when talking about scalar types. An IV is not necessarily an integer.
$ perl -MB -E'$_=123; $_=undef; say B::class B::svref_2object \$_' IV
SV is the base "class" for all Perl variables (not just scalars), but yeah, the "S" stands for "scalar".
Here goes:
| B class name | Actual SV type | Description | Example |
|---|---|---|---|
| SPECIAL | NULL | Can hold undef | perl -MB -E'say B::class B::svref_2object \undef' |
| PV | PV | Can hold undef, a string of 8 bit chars or a string of 32/64 bit chars | perl -MB -E'say B::class B::svref_2object \"a"' |
| IV | IV | Can hold undef, a reference, a signed int or an unsigned integer | perl -MB -E'say B::class B::svref_2object \123' |
| NV | NV | Can hold undef or a floating point number | perl -MB -E'say B::class B::svref_2object \1.3' |
| PVIV | PVIV | Can hold undef, a reference, a signed int, an unsigned integer, a string of 8 bit chars and/or a string of 32/64 bit chars | perl -MB -E'$_=123; "".$_; say B::class B::svref_2object \$_' |
| PVNV | PVNV | Can hold undef, a reference, a signed int, an unsigned integer, a floating point number, a string of 8 bit chars and/or a string of 32/64 bit chars | perl -MB -E'$_=1.3; "".$_; say B::class B::svref_2object \$_' |
| PVMG | PVMG | A PVNV that supports magic | perl -MB -E'say B::class B::svref_2object \$|' |
| PVLV | PVLV | A PVMG with extra fields, used for lvalues | perl -MB -E'say B::class B::svref_2object \substr("",0)' |
| GV | PVGV | A glob | perl -MB -E'say B::class B::svref_2object \*FOO' |
| AV | PVAV | An array | perl -MB -E'say B::class B::svref_2object []' |
| HV | PVHV | A hash | perl -MB -E'say B::class B::svref_2object {}' |
| CV | PVCV | A sub | perl -MB -E'say B::class B::svref_2object sub{}' |
| FM | PVFM | A format |
|
| IO | PVIO | Can hold a file handle or a directory handle | perl -MB -E'say B::class B::svref_2object *STDOUT{IO}' |
| REGEXP | REGEXP | A regexp object | perl -MB -E'say B::class B::svref_2object qr//' |
The "P" in "PV" is for "pointer".
Where "and/or" is used, all combinations are possible, with the following exceptions:
While it is technically possible for some scalars to contain both a reference and something else, Perl doesn't create these, and I don't know how safe it is.
In reply to Re: Where to find info on low level perl internals names?
by ikegami
in thread Where to find info on low level perl internals names?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |