Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Tossing unwanted values from returned list

by boo_radley (Parson)
on Nov 18, 2003 at 00:04 UTC ( #307865=note: print w/replies, xml ) Need Help??


in reply to Tossing unwanted values from returned list

instead of wasting the trash scalar, you can use LHS undefs:

(undef, $foo, undef, undef, $bar) =(1..5); print "$foo $bar";
but in general, I will use split 'in parens with brackets' as you mentioned. It's pretty direct, you don't waste any characters dealing with elements that you're ignoring.
($foo, $bar) =(1..5)[1,4]; print "$foo $bar";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://307865]
help
Chatterbox?
[james28909]: well who is the person who gets to decide which behaviour is worthy of a downvote? a person with their own beliefs? xD
[erix]: teleology -- I've never understood why that was thunk up
[erix]: ( and when teleology was brought up, during my biology-study., I couldn't get an answer either )
[1nickt]: FTR I agree with you about "design." Just not sure about the trajectory of evolution. THere are a lot of dead-ends in the evolutionary paths. I suspect homo sapiens is just one of them.
[james28909]: thanks for the vid holli, i do like it. thanks for sharing :)
[holli]: gives me goosebumps every time I watch it
holli gotta grab some groceries before dawn. l8ters
[erix]: s/dawn/dusk/

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2017-12-15 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (433 votes). Check out past polls.

    Notices?