From 88f9363122d5944ff53902410eb2f78e9600b595 Mon Sep 17 00:00:00 2001 From: Kateryna Tokar Date: Wed, 23 Oct 2019 21:37:42 +0200 Subject: [PATCH] Added Baklava in Perl --- archive/p/perl/README.md | 2 ++ archive/p/perl/baklava.pl | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 archive/p/perl/baklava.pl diff --git a/archive/p/perl/README.md b/archive/p/perl/README.md index 3983b0cb6..ab316e579 100644 --- a/archive/p/perl/README.md +++ b/archive/p/perl/README.md @@ -4,6 +4,7 @@ Welcome to Sample Programs in Perl! ## Sample Programs +- [Baklava in Perl][8] - [Capitalize in Perl](capitalize.pl) - [Even/Odd in Perl](even-odd.pl) - [Factorial in Perl](factorial.pl) @@ -32,4 +33,5 @@ Welcome to Sample Programs in Perl! [5]: https://www.perl.org [6]: https://www.jdoodle.com/execute-perl-online [7]: https://github.com/TheRenegadeCoder/sample-programs/issues/1501 +[8]: https://github.com/TheRenegadeCoder/sample-programs/issues/1511 diff --git a/archive/p/perl/baklava.pl b/archive/p/perl/baklava.pl new file mode 100644 index 000000000..26060dc07 --- /dev/null +++ b/archive/p/perl/baklava.pl @@ -0,0 +1,13 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +my $size = 10; + +for my $i (1..$size){ + print " "x($size + 1 - $i), "*"x($i*2 - 1), "\n"; +} + +for my $j (0..$size){ + print " "x($j), "*"x($size*2 - $j*2 + 1), "\n"; +} \ No newline at end of file