Blog
Developers
Careers
Support
Contact
Gossamer Threads
Solutions
Results
About
Mailing Lists
Resource Centre
Forum
Tools
Home
Who's Online
Tags
Favourites
Login
Forum Search
(
Advanced Search
)
This forum
This category
All forums
for
Home
:
General
:
Perl Programming
:
rotate ( i think come one may need it )
Previous Thread
Next Thread
Print Thread
View Threaded
Nov 22, 2007, 2:59 AM
courierb
User
(344 posts)
Nov 22, 2007, 2:59 AM
Post #1 of 1
Views: 2291
Shortcut
rotate ( i think come one may need it )
copy from other place.
my $next_file = rotate( qw/FileA FileB FileC Filed / );
print $next_file->(), "\n" for 1 .. 50;
sub rotate {
my @list = @_;
my $index = -1;
return sub {
$index++;
$index = 0 if $index > $#list;
return $list[ $index ];
};
}
Previous Thread
Next Thread
Print Thread
View Threaded