Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^3: undefined elements in array

by Athanasius (Canon)
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,

Comment on Re^3: undefined elements in array
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (17)
As of 2015-11-30 15:33 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (774 votes), past polls