Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: any built in function to take out null arrays elements?

by papidave (Monk)
on Sep 21, 2007 at 19:58 UTC ( #640434=note: print w/replies, xml ) Need Help??


in reply to any built in function to take out null arrays elements?

As chromatic mentioned, the empty string '', the NULL value undef, and the empty list () are not the same thing. If you declare my @user2, you get an empty list, which is a valid list with zero elements. When you catenate lists, e.g.
my @main = ( @user1, @user2 );
you will have zero elements appended to the original 3, resulting in a list of 3 elements. There are no undef elements to compress. When I find one in my list, it probably means I have a defect in the code that built the list.

One thing to consider when looking for that defect is your use of delete on an array element. Doing so will create undefined elements in the list, not remove them.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://640434]
help
Chatterbox?
[Corion]: choroba: Ah, that will be next Friday for $work ;) Drinking enough water is key ;))
[Corion]: But then, maybe that's just my experience with things, and maybe Hacker News is just people much younger who haven't seen more than one tech cycle...
[choroba]: s/water/bear/ and s/enough/too much/
[choroba]: beer
[choroba]: oh ok
[marto]: I crashed the ScotLUG Christmas night, having never actually been to ScotLUG
[choroba]: Corion yeah, I probably already told you about how Bjarne Stroustrup was asked whether he still watched the new tech trends and what really impressed him
[choroba]: His reply was "I watch them, but I haven't been impressed in the last 10 years. There's been nothing new". That was 2 years ago :)
[ambrus]: Ok, the docs is somewhat unclear. It does say that when an object is garbage collected, it will get cleaned up, and eventually can no longer get messages. It's not clear how long this takes, eg. I think it's kept alive until its queued events are handled
[ambrus]: in the loop, and I'm not sure if that's ok for AnyEvent. Also, it's not clear if a Timer or File object you free really is garbage collected, i.e. that Prima doesn't keep some references to it, but I hope so.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2016-12-09 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.