aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2019-05-06 02:03:18 +0100
committerGitHub <noreply@github.com>2019-05-06 02:03:18 +0100
commit91862871621ec79b097680f6a1cf0d35b942ae61 (patch)
treefbec54897223eb4ab5b16cbcda8e5e49e50aa55c
parentc6582e711349d446c50f2caae45616693ffe07fd (diff)
parent08315762f164267313da09614ff58ab427cd1297 (diff)
downloadperlweeklychallenge-club-91862871621ec79b097680f6a1cf0d35b942ae61.tar.gz
perlweeklychallenge-club-91862871621ec79b097680f6a1cf0d35b942ae61.tar.bz2
perlweeklychallenge-club-91862871621ec79b097680f6a1cf0d35b942ae61.zip
Merge pull request #125 from adamcrussell/challenge-006
Challenge 006
-rw-r--r--challenge-006/adam-russell/blog.txt1
-rw-r--r--challenge-006/adam-russell/perl5/ch-1.pl13
-rw-r--r--challenge-006/adam-russell/perl5/ch-2.pl12
3 files changed, 26 insertions, 0 deletions
diff --git a/challenge-006/adam-russell/blog.txt b/challenge-006/adam-russell/blog.txt
new file mode 100644
index 0000000000..43677563de
--- /dev/null
+++ b/challenge-006/adam-russell/blog.txt
@@ -0,0 +1 @@
+https://adamcrussell.livejournal.com/2178.html
diff --git a/challenge-006/adam-russell/perl5/ch-1.pl b/challenge-006/adam-russell/perl5/ch-1.pl
new file mode 100644
index 0000000000..72f3a8dc28
--- /dev/null
+++ b/challenge-006/adam-russell/perl5/ch-1.pl
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+##
+# Create a script which takes a list of numbers from command line and print
+# the same in the compact form. For example, if you pass "1,2,3,4,9,10,14,15,16" then
+# it should print the compact form like “1-4,9,10,14-16”.
+##
+use Data::Dump q/pp/;
+my @a = split(/\,/, $ARGV[0]);
+my $a = pp @a;
+$a =~ s/\.{2}/-/g;
+$a =~ tr/( )//d;
+print "$a\n";
diff --git a/challenge-006/adam-russell/perl5/ch-2.pl b/challenge-006/adam-russell/perl5/ch-2.pl
new file mode 100644
index 0000000000..608476b08f
--- /dev/null
+++ b/challenge-006/adam-russell/perl5/ch-2.pl
@@ -0,0 +1,12 @@
+use strict;
+use warnings;
+##
+# Create a script to calculate Ramanujan’s constant with at least 32 digits of precision.
+##
+use Math::BigFloat;
+my $accuracy = $ARGV[0];
+my $x = new Math::BigFloat(163);
+$x -> bsqrt();
+$x -> bmul(Math::BigFloat->bpi());
+$x -> bexp($accuracy);
+print "$x\n";