aboutsummaryrefslogtreecommitdiff
path: root/challenge-002
diff options
context:
space:
mode:
authorAlexander <39702500+threadless-screw@users.noreply.github.com>2019-04-03 20:50:12 +0000
committerGitHub <noreply@github.com>2019-04-03 20:50:12 +0000
commit01c4ceda01fe634ae72d6f132c20eadbb629fa71 (patch)
treea11735c014e9f30e7a60e1ade1c950e412bea03c /challenge-002
parentf72e62a4db7b80c9171fb150bcfd212d345498ff (diff)
downloadperlweeklychallenge-club-01c4ceda01fe634ae72d6f132c20eadbb629fa71.tar.gz
perlweeklychallenge-club-01c4ceda01fe634ae72d6f132c20eadbb629fa71.tar.bz2
perlweeklychallenge-club-01c4ceda01fe634ae72d6f132c20eadbb629fa71.zip
Create ch-1.p6
Diffstat (limited to 'challenge-002')
-rw-r--r--challenge-002/ozzy/perl6/ch-1.p616
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-002/ozzy/perl6/ch-1.p6 b/challenge-002/ozzy/perl6/ch-1.p6
new file mode 100644
index 0000000000..cd98d990b9
--- /dev/null
+++ b/challenge-002/ozzy/perl6/ch-1.p6
@@ -0,0 +1,16 @@
+#!/usr/bin/env perl6
+# The simplest solution I could think of was conversion of a numeric (integer) string through
+# the use of the built-in Int method. Provide a commandline argument like "004", and the script
+# will output: 4.
+#
+# In a Perl6/Bash one-liner, this would look something like this:
+# perl6 -pe '$_=.Int' <<< "004"
+# but this, in itself, isn't very practical since Bash can do it with even less fuzz:
+# a="004"
+# echo ${a##+(0)}
+
+sub MAIN (Str $numeric_string) {
+
+ say $numeric_string.Int;
+}
+