aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2019-09-29 04:52:53 +0100
committerGitHub <noreply@github.com>2019-09-29 04:52:53 +0100
commit9453b7d6e3723f70ae35fb05c28c821ada1971f8 (patch)
treeb21ef947d0e5958135eb0086d8ae844e9e47d464
parentd58f9964e07cebcb867b03d9e3dd2c09d954d071 (diff)
parent7bfac2061d9a46db4d2f8405f0f230f1641daa28 (diff)
downloadperlweeklychallenge-club-9453b7d6e3723f70ae35fb05c28c821ada1971f8.tar.gz
perlweeklychallenge-club-9453b7d6e3723f70ae35fb05c28c821ada1971f8.tar.bz2
perlweeklychallenge-club-9453b7d6e3723f70ae35fb05c28c821ada1971f8.zip
Merge pull request #674 from Doomtrain14/master
Added perl6 solution task#2
-rw-r--r--challenge-027/yet-ebreo/perl6/ch-2.p623
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-027/yet-ebreo/perl6/ch-2.p6 b/challenge-027/yet-ebreo/perl6/ch-2.p6
new file mode 100644
index 0000000000..52f254c429
--- /dev/null
+++ b/challenge-027/yet-ebreo/perl6/ch-2.p6
@@ -0,0 +1,23 @@
+# Write a script that allows you to capture/display historical data. It could be an object or a scalar. For example
+# my $x = 10; $x = 20; $x -= 5;
+# After the above operations, it should list $x historical value in order.
+
+class hist {
+ has @.history;
+ has $!var handles <Str gist FETCH Numeric>;
+ method STORE($val) {
+ push @.history, $val;
+ $!var = $val;
+ }
+}
+
+my \x = hist.new(history => []);
+
+x = 10;
+x = 20;
+x -= 5;
+x = 3.1416;
+x = Q[a quick brown fox jumps over the lazy dog];
+x = 1e3;
+x*= sqrt 3;
+.say for x.history;