Re: Looping through an anonymous array of arrays
- From: merlyn@xxxxxxxxxxxxxx (Randal L. Schwartz)
- Date: Sun, 08 Jun 2008 10:44:25 -0700
"(Randal" == (Randal L Schwartz) <merlyn@xxxxxxxxxxxxxx> writes:
(Randal> my @items = @$arrayRef;
(Randal> while (@items) {
(Randal> if (ref $items[0]) {
(Randal> if (ref $items[0] eq "ARRAY") {
(Randal> unshift @items, @{shift @items}; # replace arrayref with contents
(Randal> redo;
next, not redo. Sorry. Otherwise, [] is improperly undef-printed. :)
(Randal> }
(Randal> die "cannot handle ref of type ", ref $items[0];
(Randal> }
(Randal> print shift @items;
(Randal> }
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@xxxxxxxxxxxxxx> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
.
- References:
- Looping through an anonymous array of arrays
- From: Rodrick Brown
- Re: Looping through an anonymous array of arrays
- From: Gunnar Hjalmarsson
- Re: Looping through an anonymous array of arrays
- From: Aruna Goke
- Re: Looping through an anonymous array of arrays
- From: Randal L. Schwartz
- Looping through an anonymous array of arrays
- Prev by Date: Re: HoH problem representing a data structure.
- Next by Date: Mechanize or LWP::RobotUA - which one does it
- Previous by thread: Re: Looping through an anonymous array of arrays
- Next by thread: Re: Looping through an anonymous array of arrays
- Index(es):
Relevant Pages
|