Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Is this normal

by dave_the_m (Parson)
on Jan 06, 2012 at 23:30 UTC ( #946682=note: print w/ replies, xml ) Need Help??


in reply to Re: Is this normal
in thread Is this normal

a non-match does not return 0. It returns the empty string
Strictly speaking, it returns PL_sv_no, which has both a numerical value of 0 and a string value of "":
$ perl5140 -MDevel::Peek -e 'Dump scalar(/x/)' SV = PVNV(0x275ee10) at 0xa26500 REFCNT = 2147483647 FLAGS = (IOK,NOK,POK,READONLY,pIOK,pNOK,pPOK) IV = 0 NV = 0 PV = 0x275ee00 ""\0 CUR = 0 LEN = 16

Dave.


Comment on Re^2: Is this normal
Download Code
Re^3: Is this normal
by JavaFan (Canon) on Jan 07, 2012 at 08:45 UTC
    You are correct. However, the OP is printing out the values, so the string value will be taken.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://946682]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2015-07-02 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (45 votes), past polls