my $FP = 'D:\conv';
my $TP = 'D:\sgml_db';
my $cwd = `cd`; # Get current working directory
my ($from_dir, $to_dir) = ($cwd, $cwd);
# if your current working directory ($to_dir) doesn't have 'D:\conv' the below line doesn't change the value of $to_dir.
# So $to_dir equals to current directory and it already exists.
# So mkpath($to_dir) doesn't work.
$to_dir =~ s/^\Q$FP\E/$TP/;
mkpath($to_dir);
So ensure your $to_dir value must match the $FP value and you will be get the expected output.
k_manimuthu
Junior Poster in Training
93 posts since Jun 2009
Reputation Points: 55
Solved Threads: 24
$to_file =~ s/^(\w+)(\d*)\.(\w+)$/"$prefix_" . uc($1) . ($2 || 0) ."_ESM.$3"/e;
For your output format purpose you added "_". But it treated as a scalar variable. So change "$prefix_" to "$prefix" for the above line.
Hello friend, Is the below lines are working in your program? why you use the lines?
my $some_file = (<$to_dir>)[0];
my ($prefix) = $some_file =~ m/(\d+_\d+_\d+)[^\\]*$/;
k_manimuthu
Junior Poster in Training
93 posts since Jun 2009
Reputation Points: 55
Solved Threads: 24