Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by tcf03 (Deacon)
on Sep 22, 2007 at 11:26 UTC ( #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? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2022-05-28 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (98 votes). Check out past polls.

    Notices?