Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: undefined elements in array

by Athanasius (Chancellor)
on Aug 20, 2013 at 14:17 UTC ( #1050188=note: print w/replies, xml ) Need Help??


in reply to Re^2: undefined elements in array
in thread undefined elements in array

I think you meant grep, not map:

0:14 >perl -wE "@a = (1,2,3,undef,5); say scalar @a; @b = map(defined +, @a); print join(',', @b);" 5 1,1,1,,1 0:14 >perl -wE "@a = (1,2,3,undef,5); say scalar @a; @b = grep(define +d, @a); print join(',', @b);" 5 1,2,3,5 0:14 >

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050188]
help
Chatterbox?
[Tanktalus]: great, now I'm going to have to convert html codes to text for display... :)
[choroba]: Can you steal the code from pm-cb-g?
[Tanktalus]: maybe next week at the earliest. :P

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2017-09-25 21:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (291 votes). Check out past polls.

    Notices?