Epligam Epligam - 1 year ago 80
Perl Question

Perl create folder combination of variable and underscore

How can I create a folder which is a combination of a variable and underscore ( and other special characters ) on Windows ?

I need to create this folder C:\CD12.0\PROD12.0_NEW so I tried this

use File::Basename;
use File::Path;
my $version = "12.0";
mkpath("C:/CD$version/PROD$version_NEW") or die;

Get this error

Global symbol "$version_NEW" requires explicit package name

Answer Source

You have to use curly braces: try ${version}

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download