in reply to Tossing unwanted values from returned list
instead of wasting the trash scalar, you can use LHS undefs:
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.(undef, $foo, undef, undef, $bar) =(1..5); print "$foo $bar";
($foo, $bar) =(1..5)[1,4]; print "$foo $bar";
|
---|
In Section
Seekers of Perl Wisdom