aboutsummaryrefslogtreecommitdiff
path: root/challenge-045/arne-sommer/perl/square-secret-code-perl
blob: 931ad0badf1644f5593860111c0ddb049af462d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /usr/bin/env perl

my $string = $ARGV[0] || "The quick brown fox jumps over the lazy dog";

$string =~ tr/ //d;

my @a = split(//, lc $string);

@a.shift;
@a.pop;

for my $word (0 .. 7)
{
  my $index = $word;
  while (1)
  {
    defined $a[$index]
      ? print $a[$index]
      : print(" ") && last;

   $index += 8;
  }
}

print "\n";