diff options
| author | lakpatashi <lakpatashi@gmail.com> | 2021-04-18 18:10:17 +0530 |
|---|---|---|
| committer | lakpatashi <lakpatashi@gmail.com> | 2021-04-18 18:10:17 +0530 |
| commit | 028d591894422f3513e799145cd86a1e27bcb771 (patch) | |
| tree | ced7cf94d43a8973cee912ff3f41b90dd4f3c295 /challenge-011 | |
| parent | 15e0afcd407b324158e261bca7b00fe85ba9dd57 (diff) | |
| download | perlweeklychallenge-club-028d591894422f3513e799145cd86a1e27bcb771.tar.gz perlweeklychallenge-club-028d591894422f3513e799145cd86a1e27bcb771.tar.bz2 perlweeklychallenge-club-028d591894422f3513e799145cd86a1e27bcb771.zip | |
Finished challenge-011 with perl
Diffstat (limited to 'challenge-011')
| -rw-r--r-- | challenge-011/lakpatashi/README | 1 | ||||
| -rwxr-xr-x | challenge-011/lakpatashi/perl/ch-1.pl | 18 | ||||
| -rwxr-xr-x | challenge-011/lakpatashi/perl/ch-2.pl | 21 |
3 files changed, 40 insertions, 0 deletions
diff --git a/challenge-011/lakpatashi/README b/challenge-011/lakpatashi/README new file mode 100644 index 0000000000..bc153bd576 --- /dev/null +++ b/challenge-011/lakpatashi/README @@ -0,0 +1 @@ +Solution by lakpatashi diff --git a/challenge-011/lakpatashi/perl/ch-1.pl b/challenge-011/lakpatashi/perl/ch-1.pl new file mode 100755 index 0000000000..5561e0a700 --- /dev/null +++ b/challenge-011/lakpatashi/perl/ch-1.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl + +use warnings; +use strict; +use Data::Dumper; +use List::Util qw(sum); +use feature qw(switch); +#part 1 +my $stepF = 1.8; + +my $f = -148; +print "F:\tC\n"; +for (my $c=-100;$c <= 100; $c++ ){ + print int $f,": $c\n" if $f==$c; + $f = sprintf "%.1f", $f+$stepF; +} + + diff --git a/challenge-011/lakpatashi/perl/ch-2.pl b/challenge-011/lakpatashi/perl/ch-2.pl new file mode 100755 index 0000000000..00ecfda74c --- /dev/null +++ b/challenge-011/lakpatashi/perl/ch-2.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use warnings; +use strict; +use Data::Dumper; +use List::Util qw(sum); +use feature qw(switch); + +#part 2 +my @arr; +my $n = 3; +for (my $i =0; $i < $n; $i++){ + for (my $j =0; $j < $n; $j++){ + $arr[$i][$j] = $i==$j? 1 : 0; + } +} + + +for my $line (@arr){ + print join(' ',@{$line} ),"\n"; +} |
