diff options
| author | Abigail <abigail@abigail.be> | 2021-01-26 01:53:18 +0100 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-01-26 12:07:41 +0100 |
| commit | 3a68dc14c70c709ea8097e98e38931ef93e643af (patch) | |
| tree | ded81f35239c77dea4d19c1027ec664cc8cff6d8 /challenge-097/abigail/perl | |
| parent | 1889deddca521e1aa013d53a749c693c6589deba (diff) | |
| download | perlweeklychallenge-club-3a68dc14c70c709ea8097e98e38931ef93e643af.tar.gz perlweeklychallenge-club-3a68dc14c70c709ea8097e98e38931ef93e643af.tar.bz2 perlweeklychallenge-club-3a68dc14c70c709ea8097e98e38931ef93e643af.zip | |
Use option -s (shift), instead of -t.
Diffstat (limited to 'challenge-097/abigail/perl')
| -rw-r--r-- | challenge-097/abigail/perl/ch-1.pl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/challenge-097/abigail/perl/ch-1.pl b/challenge-097/abigail/perl/ch-1.pl index eabc49db2c..9a94c07550 100644 --- a/challenge-097/abigail/perl/ch-1.pl +++ b/challenge-097/abigail/perl/ch-1.pl @@ -14,19 +14,19 @@ use experimental 'lexical_subs'; # # -# Run as: perl ch-1.pl -t TIMES < input-file +# Run as: perl ch-1.pl -s TIMES < input-file # use Getopt::Long; -GetOptions 't=i' => \my $times; +GetOptions 's=i' => \my $shift; -die "-t option required" unless defined $times; +die "-s option required" unless defined $shift; -$times %= 26; +$shift %= 26; while (<>) { chomp; - s/([A-Z])/my $ch = ord ($1) - $times; $ch += 26 if $ch < 65; chr $ch/eg; + s/([A-Z])/my $ch = ord ($1) - $shift; $ch += 26 if $ch < 65; chr $ch/eg; say; } |
