Skip to Content
Search
Products
Hosting
Support
Resources
Contact
Home
Who's Online
Tags
Favourites
Login
Register
Search
this forum
this category
all forums
for
Advanced Search
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
(248 posts)
Nov 22, 2007, 2:59 AM
Post #1 of 1
Views: 242
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