From 20ca0710d16f90dae678786c2f1a7055f8710cfb Mon Sep 17 00:00:00 2001 From: Ysmael Ebreo Date: Tue, 22 Oct 2019 09:38:03 +0800 Subject: Updated solution/comments ch#31-1 --- challenge-031/yet-ebreo/perl5/ch-2.pl | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/challenge-031/yet-ebreo/perl5/ch-2.pl b/challenge-031/yet-ebreo/perl5/ch-2.pl index 92895a9f46..c0909137e7 100644 --- a/challenge-031/yet-ebreo/perl5/ch-2.pl +++ b/challenge-031/yet-ebreo/perl5/ch-2.pl @@ -25,10 +25,24 @@ $$varname = 0|100*rand; # Should update the value of the variable being referred to # the code below will print the random generated value assigned -# to the reference *IF* the user inputs "dynamic_var" as -# the variable name, otherwise the variable will be empty - -say $dynamic_var; +# to the reference. +say "You created a variable named \"$ARGV[0]\" and has a value of ${$ARGV[0]}\n"; +say "This line prints the value of a variable named dynamic_var: [$dynamic_var]"; +say "If the user inputs the same variable name, dynamic_var variable will have value otherwise it will be empty\n"; #NOTE: because of the nature of the task, # use strict was removed. + +=begin +perl .\ch-2.pl dynamic_var +You created a variable named "dynamic_var" and has a value of 78 + +This line prints the value of a variable named dynamic_var: [78] +If the user inputs the same variable name, dynamic_var variable will have value otherwise it will be empty + +perl .\ch-2.pl my_var +You created a variable named "my_var" and has a value of 38 + +This line prints the value of a variable named dynamic_var: [] +If the user inputs the same variable name, dynamic_var variable will have value otherwise it will be empty +=cut \ No newline at end of file -- cgit