use warnings;
use strict;
use diagnostics;
my @arr = ('a'..'z');
print "@arr\n";
foreach my $thing (@arr) {
my $ele = pop @arr;
my $stuff = unshift @arr, $ele;
print "$ele ";
}
####
C:\perlscripts>perl arrays.pl
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 y x w v u t s r q p o n m l k j i h g f e d c b a
C:\perlscripts>
####
use warnings;
use strict;
use diagnostics;
my @arr = ('a'..'z');
print "@arr\n";
foreach my $thing (@arr) {
print "[$thing]";
my $ele = pop @arr;
my $stuff = unshift @arr, $ele;
print "$ele ";
}
####
C:\perlscripts>perl arrays.pl
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
[a]z [a]y [a]x [a]w [a]v [a]u [a]t [a]s [a]r [a]q [a]p [a]o [a]n [a]m [a]l [a]k [a]j [a]i [a]h [a]g [a]f [a]e [a]d [a]c [a]b [a]a
C:\perlscripts>