From ad4031ad944a6ee247c953c7d3e8c98e27fe5f23 Mon Sep 17 00:00:00 2001 From: drbaggy Date: Thu, 24 Feb 2022 10:17:37 +0000 Subject: added a pretty print version of the code to display the numbers with "," and right aligned --- challenge-153/james-smith/perl/ch-1.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/challenge-153/james-smith/perl/ch-1.pl b/challenge-153/james-smith/perl/ch-1.pl index 5f6777bb9b..8a8c83f012 100644 --- a/challenge-153/james-smith/perl/ch-1.pl +++ b/challenge-153/james-smith/perl/ch-1.pl @@ -4,5 +4,10 @@ use strict; use warnings; use feature qw(say); +## Normal print say my $t = my $f = 1; say $t += ($f*=$_) for 1..20; + +## Pretty print!! Single lining commify.... +printf "%26s\n", $t = $f = 1; +printf "%26s\n", scalar reverse ( reverse ($t += ($f*=$_)) =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/gr ) for 1..20; -- cgit