aboutsummaryrefslogtreecommitdiff
path: root/challenge-031/lars-thegler/perl5/ch-2.pl
blob: 03bd6adf13d20d2147e04fd6daf72c09f6f2226b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env perl

use Modern::Perl;

# 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.

my $variable_name = shift or die 'missing variable name';

no strict 'refs';
$$variable_name = 42;

say "name=$variable_name, value=$$variable_name";