Sprad has asked for the wisdom of the Perl Monks concerning the following question:
If the ones you want are at the beginning of the list, it's easy:
($foo, $bar) = split(" ", $baz);
But if they're somewhere in the middle, I typically do this:
Using $trash makes it easy for me to see which values I actually care about.($trash, $trash, $foo, $trash, $bar) = split(" ", $baz);
There are other ways, too. You can enclose the split in parens and use brackets to access particular elements, like an array. But is there a widely accepted method that I'm missing?
---
A fair fight is a sign of poor planning.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tossing unwanted values from returned list
by boo_radley (Parson) on Nov 18, 2003 at 00:04 UTC | |
|
Re: Tossing unwanted values from returned list
by simonm (Vicar) on Nov 18, 2003 at 00:05 UTC | |
|
Re: Tossing unwanted values from returned list
by dpuu (Chaplain) on Nov 18, 2003 at 00:04 UTC | |
|
Re: Tossing unwanted values from returned list
by Roger (Parson) on Nov 18, 2003 at 00:49 UTC | |
|
Re: Tossing unwanted values from returned list
by doran (Deacon) on Nov 18, 2003 at 05:33 UTC | |
by Sprad (Hermit) on Nov 18, 2003 at 16:17 UTC | |
|
Re: Tossing unwanted values from returned list
by pizza_milkshake (Monk) on Nov 18, 2003 at 03:52 UTC | |
|
Re: Tossing unwanted values from returned list
by Anonymous Monk on Nov 18, 2003 at 14:34 UTC |