Your code didn't really revert the array. Try printing the array in each step:
a b c d e f g h i j k l m n o p q r s t u v w x y z
z a b c d e f g h i j k l m n o p q r s t u v w x y
y z a b c d e f g h i j k l m n o p q r s t u v w x
x y z a b c d e f g h i j k l m n o p q r s t u v w
w x y z a b c d e f g h i j k l m n o p q r s t u v
v w x y z a b c d e f g h i j k l m n o p q r s t u
u v w x y z a b c d e f g h i j k l m n o p q r s t
t u v w x y z a b c d e f g h i j k l m n o p q r s
s t u v w x y z a b c d e f g h i j k l m n o p q r
r s t u v w x y z a b c d e f g h i j k l m n o p q
q r s t u v w x y z a b c d e f g h i j k l m n o p
p q r s t u v w x y z a b c d e f g h i j k l m n o
o p q r s t u v w x y z a b c d e f g h i j k l m n
n o p q r s t u v w x y z a b c d e f g h i j k l m
m n o p q r s t u v w x y z a b c d e f g h i j k l
l m n o p q r s t u v w x y z a b c d e f g h i j k
k l m n o p q r s t u v w x y z a b c d e f g h i j
j k l m n o p q r s t u v w x y z a b c d e f g h i
i j k l m n o p q r s t u v w x y z a b c d e f g h
h i j k l m n o p q r s t u v w x y z a b c d e f g
g h i j k l m n o p q r s t u v w x y z a b c d e f
f g h i j k l m n o p q r s t u v w x y z a b c d e
e f g h i j k l m n o p q r s t u v w x y z a b c d
d e f g h i j k l m n o p q r s t u v w x y z a b c
c d e f g h i j k l m n o p q r s t u v w x y z a b
b c d e f g h i j k l m n o p q r s t u v w x y z a
a b c d e f g h i j k l m n o p q r s t u v w x y z
So, you rather "rotated" it, and it ended up being exactly the same as in the beginning.
As to $thing: changing the array you iterate over is dangerous. In this case, check what's the first element in the first iteration, second element in the second iteration, etc. You don't need to use the loop variable, it's there only to guarantee the number of iterations; I'd probably just write
for (@arr) {
or, to avoid changing the array being iterated
for (1 .. @arr) {
to make it clear the number of steps is what matters.
($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,
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|