Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: "Good" style for splicing arrays

by massa (Hermit)
on Nov 14, 2008 at 14:10 UTC ( [id://723657]=note: print w/replies, xml ) Need Help??


in reply to Re^2: "Good" style for splicing arrays
in thread "Good" style for splicing arrays

But if you have relevant undefs in your array, things go south. That is why splice is better than the other thing... and it's shorter and so, even more perl-y.
[]s, HTH, Massa (κς,πμ,πλ)

Replies are listed 'Best First'.
Re^4: "Good" style for splicing arrays
by LanX (Saint) on Nov 14, 2008 at 15:01 UTC

    Good point, Massa! I agree that grepping for defined is no general fix of the problem!

    But in cases you really need to get undefs, the listflattening approach is better.

    e.g. parameter passing  ($self,$x,$y,@opt)=@_;

    so the two approaches are actually not two ways to do the same thing, but two different thing which only seemed interchangebal.

    ---
    Which song? ;)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-18 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found