Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Array/List Strangeness

by biohisham (Priest)
on Aug 04, 2009 at 23:21 UTC ( [id://785929]=note: print w/replies, xml ) Need Help??


in reply to Array/List Strangeness

Besides numbers and strings scalar values can also hold the value undef, uninitialzied scalar variables have this value. It is interpreted as 0 in numeric context and as the empty string "" in string context. In other instances, like in subroutines, a return value of undef would indicate failure. In the third example you presented
my @a = ()[0];
jwkrahn mentioned a concept that fits the case since you are slicing an empty list but in the previous examples you are assigning conceptually nothing and hence undef is returned as the value of $VAR1.
Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-28 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found