SPUG: spug: What is the idiomatic way to extract first/lastitem after split?
bill at celestial.com
Wed Jun 29 10:58:16 PDT 2005
On Wed, Jun 29, 2005, DeRykus, Charles E wrote:
>On 6/28/05, Bill Campbell <bill at celestial.com> wrote:
>> On Tue, Jun 28, 2005, Uri London wrote:
>>> this might not work as one expects on a list of one, since @rest will be empty. ($last will contain undef
>>>after the pop.) it's unclear from the original poster's requirements what this edge case should return.
>True and the same thing applies to J. Krahn's elegant solution. Once
>the output's drained, the rest of the list will be undefined.
When I posted my example, it was meant as that, an example. Error checking
and bounds conditions were left as an exercise for the student. It's a lot
easier to read the example if it isn't hidden in the middle of exception
INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC
UUCP: camco!bill PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
Windows is a computer virus with a user interface!!
More information about the spug-list