From dfe6c5e65b0dbbeeafba502265a8d90fbdca0222 Mon Sep 17 00:00:00 2001 From: Steven Wilson Date: Wed, 23 Oct 2019 11:45:31 +0100 Subject: add week 31 task 2 solution --- challenge-031/steven-wilson/perl5/ch-2.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 challenge-031/steven-wilson/perl5/ch-2.pl 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"; -- cgit