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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.