diff options
| author | Ryan Thompson <i@ry.ca> | 2020-01-08 19:34:20 -0600 |
|---|---|---|
| committer | Ryan Thompson <i@ry.ca> | 2020-01-08 19:34:20 -0600 |
| commit | d0a19b1f8bd44f204fe86afa095c4a2bcc6497c5 (patch) | |
| tree | f633eef3dea6287f2b421f2c6af6d71f9e2e34d0 /challenge-042 | |
| parent | 2469f0d4af48f0e85b5ae1938a06ae2f9be3592d (diff) | |
| download | perlweeklychallenge-club-d0a19b1f8bd44f204fe86afa095c4a2bcc6497c5.tar.gz perlweeklychallenge-club-d0a19b1f8bd44f204fe86afa095c4a2bcc6497c5.tar.bz2 perlweeklychallenge-club-d0a19b1f8bd44f204fe86afa095c4a2bcc6497c5.zip | |
Challenge #1 and blog
Diffstat (limited to 'challenge-042')
| -rw-r--r-- | challenge-042/ryan-thompson/blog.txt | 1 | ||||
| -rwxr-xr-x | challenge-042/ryan-thompson/perl5/ch-1.pl | 11 | ||||
| -rw-r--r-- | challenge-042/ryan-thompson/perl6/ch-1.p6 | 11 |
3 files changed, 23 insertions, 0 deletions
diff --git a/challenge-042/ryan-thompson/blog.txt b/challenge-042/ryan-thompson/blog.txt new file mode 100644 index 0000000000..b8da5256e9 --- /dev/null +++ b/challenge-042/ryan-thompson/blog.txt @@ -0,0 +1 @@ +http://www.ry.ca/2020/01/octal-representation/ diff --git a/challenge-042/ryan-thompson/perl5/ch-1.pl b/challenge-042/ryan-thompson/perl5/ch-1.pl new file mode 100755 index 0000000000..82cd92002c --- /dev/null +++ b/challenge-042/ryan-thompson/perl5/ch-1.pl @@ -0,0 +1,11 @@ +#!/usr/bin/env perl +# +# ch-1.pl - Print octal numbers from 0..50 +# +# Ryan Thompson <rjt@cpan.org> + +# No need to get fancy: +printf "Decimal %2d = Octal %2o\n", $_, $_ for 0..50; + +# This printf feature will be important for our Raku solution: +printf 'Decimal %1$2d = Octal %1$2o'."\n", $_ for 0..50; diff --git a/challenge-042/ryan-thompson/perl6/ch-1.p6 b/challenge-042/ryan-thompson/perl6/ch-1.p6 new file mode 100644 index 0000000000..7fb8177166 --- /dev/null +++ b/challenge-042/ryan-thompson/perl6/ch-1.p6 @@ -0,0 +1,11 @@ +#!/usr/bin/env perl6 + +# ch-1.p6 - Print octal numbers from 0..50 +# +# Ryan Thompson <rjt@cpan.org> + +# Perl5 method still works, verbatim +printf "Decimal %2d = Octal %2o\n", $_, $_ for 0..50; + +# This is my preferred solution: +say (0..50).fmt('Decimal %1$2d = Octal %2o', "\n"); |
