Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How to iterate thru entire array with start point other than beginning

by choroba (Cardinal)
on Sep 01, 2016 at 16:53 UTC ( [id://1170989]=note: print w/replies, xml ) Need Help??


in reply to How to iterate thru entire array with start point other than beginning

I don't understand your code. But to create "rotating" arrays, you can use the % operator - the modulo.
#!/usr/bin/perl use warnings; use strict; my @month_names = qw( January February March April May June July August September October November December ); for my $start (0 .. 11) { for my $month ($start .. 11 + $start) { print $month_names[ $month % 12 ], ' '; } print "\n"; }
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: How to iterate thru entire array with start point other than beginning
by dirtdog (Monk) on Sep 01, 2016 at 16:57 UTC

    thank you! This will work perfectly.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1170989]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found