aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wilson <steven1170@zoho.eu>2019-10-23 11:45:31 +0100
committerSteven Wilson <steven1170@zoho.eu>2019-10-23 11:45:31 +0100
commitdfe6c5e65b0dbbeeafba502265a8d90fbdca0222 (patch)
treea761f8d74e60a4c94fb124cb386579f1773c0330
parent7b668d1e5ccc841b2ce4da8de4ab69363998b3f4 (diff)
downloadperlweeklychallenge-club-dfe6c5e65b0dbbeeafba502265a8d90fbdca0222.tar.gz
perlweeklychallenge-club-dfe6c5e65b0dbbeeafba502265a8d90fbdca0222.tar.bz2
perlweeklychallenge-club-dfe6c5e65b0dbbeeafba502265a8d90fbdca0222.zip
add week 31 task 2 solution
-rw-r--r--challenge-031/steven-wilson/perl5/ch-2.pl18
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-031/steven-wilson/perl5/ch-2.pl b/challenge-031/steven-wilson/perl5/ch-2.pl
new file mode 100644
index 0000000000..4bee848a6a
--- /dev/null
+++ b/challenge-031/steven-wilson/perl5/ch-2.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/env perl
+# Author: Steven Wilson
+# Date: 2019-10-23
+# Week: 031
+
+# Task #2
+# Create a script to demonstrate creating dynamic variable name, assign
+# a value to the variable and finally print the variable. The variable
+# name would be passed as command line argument.
+# usage: $ perl ch-2.pl foo
+
+#use strict;
+#use warnings;
+use feature qw/ say /;
+
+my $dynamic_variable_name = $ARGV[0];
+$$dynamic_variable_name = "variable name was '$dynamic_variable_name'";
+say "$foo";