diff options
| -rw-r--r-- | challenge-006/adam-russell/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-006/adam-russell/perl5/ch-1.pl | 13 | ||||
| -rw-r--r-- | challenge-006/adam-russell/perl5/ch-2.pl | 12 |
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"; |
