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

Re: Difference between exists and defined

by LanX (Saint)
on Apr 16, 2019 at 10:48 UTC ( [id://1232639]=note: print w/replies, xml ) Need Help??


in reply to Difference between exists and defined

The internal implementation of arrays is very space efficient.

All used slots point to values (scalar, constant ...), but unused slots don't demand much space or even no space.

  • exists tells you if a slot is used
  • assigning undef will fill a slot with the value undef
  • defined will also return undef if a slot isn't used.

There are only little use cases where using exists on arrays can be of help.

You don't want to meddle with such internals.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found