diff options
| author | holli.holzer <holli.holzer@gmail.com> | 2019-11-08 19:15:59 +0100 |
|---|---|---|
| committer | holli.holzer <holli.holzer@gmail.com> | 2019-11-08 19:15:59 +0100 |
| commit | e2543e5151c83e1cd1b10aa577be19c6ed8e0f26 (patch) | |
| tree | 697bd055daa28c8374e214436c7c232360115ed9 /challenge-033/markus-holzer/perl6 | |
| parent | e8684edd610cc937ef8c7cae80c02c9be4575cfb (diff) | |
| download | perlweeklychallenge-club-e2543e5151c83e1cd1b10aa577be19c6ed8e0f26.tar.gz perlweeklychallenge-club-e2543e5151c83e1cd1b10aa577be19c6ed8e0f26.tar.bz2 perlweeklychallenge-club-e2543e5151c83e1cd1b10aa577be19c6ed8e0f26.zip | |
Solutions Markus Holzer
Diffstat (limited to 'challenge-033/markus-holzer/perl6')
| -rw-r--r-- | challenge-033/markus-holzer/perl6/ch-2.pl6 | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/challenge-033/markus-holzer/perl6/ch-2.pl6 b/challenge-033/markus-holzer/perl6/ch-2.pl6 index 466c66ce4f..abe1fdd28c 100644 --- a/challenge-033/markus-holzer/perl6/ch-2.pl6 +++ b/challenge-033/markus-holzer/perl6/ch-2.pl6 @@ -2,7 +2,7 @@ sub MAIN( $n = 11 ) { - my $ln = ($n * $n).Str.chars + 1; + my $ln = ( $n * $n ).Str.chars + 1; my $li = $n.chars + 1; header( $n ); @@ -11,15 +11,14 @@ sub MAIN( $n = 11 ) sub line( $i, $n ) { my @n = ( ( $i .. $n ) X* $n ).map({ sprintf( "%{$ln}s", $_ ) }); - my @e = ( ' ' xx ($ln * ($i - 1) ) ); - say sprintf( "%{$li}s", $i), "|", @e.join, @n.join; + my @e = ( ' ' xx ( $ln * ( $i - 1 ) ) ); + say sprintf( "%{$li}s", $i ), '|', @e.join, @n.join; } sub header( $n ) { - my @h = ( 1 .. $n ).map({ sprintf("%{$ln}s", $_ ) }); - say sprintf( "%{$li}s", "x" ), "|", @h.join; - say ( "-" xx $li ).join, "+", ( '-' xx ( $n * $ln ) ).join; + my @h = ( 1 .. $n ).map({ sprintf( "%{$ln}s", $_ ) }); + say sprintf( "%{$li}s", "x" ), '|', @h.join; + say ( '-' xx $li ).join, "+", ( '-' xx ( $n * $ln ) ).join; } - }
\ No newline at end of file |
