Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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";


Comment on Re: Tossing unwanted values from returned list
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2015-07-03 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls