Newsgroups: comp.lang.perl.misc
From: PerlFAQ Server <br...@stonehenge.com>
Date: Mon, 12 May 2008 12:03:02 -0700
Local: Mon, May 12 2008 3:03 pm
Subject: FAQ 4.47 How do I handle circular lists?
This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to reduce the number of repeated questions as well as allow the community to review and update the answers. The latest version of the complete perlfaq is at http://faq.perl.org . -------------------------------------------------------------------- 4.47: How do I handle circular lists? Circular lists could be handled in the traditional fashion with linked unshift(@array, pop(@array)); # the last shall be first You can also use "Tie::Cycle": use Tie::Cycle; tie my $cycle, 'Tie::Cycle', [ qw( FFFFFF 000000 FFFF00 ) ]; print $cycle; # FFFFFF -------------------------------------------------------------------- The perlfaq-workers, a group of volunteers, maintain the perlfaq. They If you'd like to help maintain the perlfaq, see the details in You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||