From 01c4ceda01fe634ae72d6f132c20eadbb629fa71 Mon Sep 17 00:00:00 2001 From: Alexander <39702500+threadless-screw@users.noreply.github.com> Date: Wed, 3 Apr 2019 20:50:12 +0000 Subject: Create ch-1.p6 --- challenge-002/ozzy/perl6/ch-1.p6 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 challenge-002/ozzy/perl6/ch-1.p6 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; +} + -- cgit