aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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";