I do not know how to name even what I want to do, I know it's weird.
I have a script and an external configuration file for this script. I want the user to be able to choose the variables themselves in an accessible form. Its something like template.
Script:
#!/usr/bin/perl -w
use strict;
my ($from, $to);
our $period;
require file.conf
$from = '2017-01-01';
$to = '2017-04-12';
print $period;
open my $fh, '>>', 'file.txt' or die "Cannot open!";
print $fh join ("\n", $period));
close $fh;
file.conf
$period = "$from \- $to";
1;
Expected output:
2017-01-01 - 2017-04-12
This same output should be in file.txt. This solution is not working, on define $period has undefinied variables $from and $to. I want use this line in different line of code.
Is such an output in some way possible? I emphasize that the idea is to make the solution the most aesthetic and most simple for the user who has no idea what a subroutine, hash or even array is.