It does not.
Really ??
Could you show me a Devel::Peek::Dump output for the scalar returned by S::U::looks_like_number('abc') - one that shows that the empty string is not returned ?
(Also, the version number of Scalar::Util on which this happens, and the 'perl -V' output.)
Scalar-Util-1.45 (perl-5.16.0):
C:\>perl -MScalar::Util -MDevel::Peek -le "Dump(Scalar::Util::looks_li
+ke_number('abc'));"
SV = PVNV(0x726f74) at 0x723250
REFCNT = 2147483647
FLAGS = (IOK,NOK,POK,READONLY,pIOK,pNOK,pPOK)
IV = 0
NV = 0
PV = 0x7229b4 ""\0
CUR = 0
LEN = 12
Scalar-Util-1.5 (perl5.30.0):
C:\>perl -MScalar::Util -MDevel::Peek -le "Dump(Scalar::Util::looks_li
+ke_number('abc'));
SV = PVNV(0x2ea0a8) at 0x2e8150
REFCNT = 2147483647
FLAGS = (IOK,NOK,POK,READONLY,PROTECT,pIOK,pNOK,pPOK)
IV = 0
NV = 0
PV = 0x6ff24e83 ""
CUR = 0
LEN = 0
My assertion the "the empty string is returned" could well be deemed incomplete because the IV and NV slots are also filled.
But the PV slot definitely contains the empty string, and it's the contents of the PV slot that are displayed by print().
AFAICS, any assertion that looks_like_number does not return the empty string for FALSE is complete bullshit.
(But I upvoted your post anyway - on the strength of the boldness and abrasiveness of its opening assertion.)
Cheere, Rob |