Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by papidave (Pilgrim)
on Sep 21, 2007 at 19:58 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://640434]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-29 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found