Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by tcf03 (Deacon)
on Sep 22, 2007 at 11:26 UTC ( [id://640511]=note: print w/replies, xml ) Need Help??


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

And when 5.10 arrives
#!/usr/local/bin/perl5.9.5 # use feature ":5.10"; use strict; use warnings; print "content-type: text/html\n\n"; my @userArray = qw(batman robin joker); my @userArray2; #this is a null array my @mainArray = (@userArray, @userArray2); my @set; # A loop, just for this example... for(@mainArray) { when ( ! defined $_ ) { next } when ( /^$/ ) { next } default { push @set, $_ } } say "@set";
I of course do not mean this as a serious (Use this in production) reply to the op.
Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2025-06-14 17:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.