diff options
| -rw-r--r-- | challenge-097/abigail/perl/ch-1.pl | 16 | ||||
| -rw-r--r-- | challenge-097/abigail/t/ctest.ini | 3 | ||||
| -rw-r--r-- | challenge-097/abigail/t/input-1-1 | 2 |
3 files changed, 15 insertions, 6 deletions
diff --git a/challenge-097/abigail/perl/ch-1.pl b/challenge-097/abigail/perl/ch-1.pl index 9ffda0a6e5..eabc49db2c 100644 --- a/challenge-097/abigail/perl/ch-1.pl +++ b/challenge-097/abigail/perl/ch-1.pl @@ -14,13 +14,19 @@ use experimental 'lexical_subs'; # # -# Run as: perl ch-1.pl < input-file +# Run as: perl ch-1.pl -t TIMES < input-file # +use Getopt::Long; + +GetOptions 't=i' => \my $times; + +die "-t option required" unless defined $times; + +$times %= 26; + while (<>) { chomp; - my ($times, $plain) = split ' ', $_, 2; - $times %= 26; - $plain =~ y/A-Z/ZA-Y/ for 1 .. $times; - say $plain; + s/([A-Z])/my $ch = ord ($1) - $times; $ch += 26 if $ch < 65; chr $ch/eg; + say; } diff --git a/challenge-097/abigail/t/ctest.ini b/challenge-097/abigail/t/ctest.ini index 0ae9d07567..8fee647f8b 100644 --- a/challenge-097/abigail/t/ctest.ini +++ b/challenge-097/abigail/t/ctest.ini @@ -1,3 +1,6 @@ [names]
1-1 = Given example
2-1 = Given examples
+
+[1-1]
+args = -t 3
diff --git a/challenge-097/abigail/t/input-1-1 b/challenge-097/abigail/t/input-1-1 index 6c3d28d154..678239264e 100644 --- a/challenge-097/abigail/t/input-1-1 +++ b/challenge-097/abigail/t/input-1-1 @@ -1 +1 @@ -3 THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG +THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG |
