Re: Looping through an anonymous array of arrays
[email protected] ((Randal L. Schwartz))
| Newsgroups | perl.beginners |
|---|---|
| Organization | Stonehenge Consulting Services; Portland, Oregon, USA |
| Message-ID | <[email protected]> |
>>>>> "(Randal" == (Randal L Schwartz) <[email protected]> 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 <[email protected]> <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