Hi Chaoui05,
Because the $folder variable is declared with my, it exists only for the scope of the config file and is not accessible from the main script. One quick solution would be to replace the "my" with an "our" in the config file, as that declares the variable as a package ("global") variable, then add a declaration of "our $folder;" (or "use vars qw/$folder/;", but that's discouraged) before the line with do 'work.conf' (this is to satisfy strict), then the variable $folder will be accessible in the script, and then you can do:
use File::Spec::Functions qw/catfile/; my $filename = catfile($folder, $config->{license});
Hope this helps,
-- Hauke D
Edit: Minor updates to wording.
In reply to Re: Recover a path from a config file
by haukex
in thread Recover a path from a config file
by Chaoui05
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |