The following code snippet is throwing error if i use the mkpath command.Can any one help please?
i get the following error message:
D:\perl_prj>perl ex2.pl a.csv
mkdir IDS/CPIDS
: Invalid argument; The filename, directory name, or volume label syntax is incorrect at ex2.pl line 28

use File::Path;

#get file name from command line
$fname = @ARGV[0];
$vt = ht62_ucm;
$ucm_path='M:/ht62_ucm/GIS_COMP';
#open the file for reading
if (open FHR, "$fname")
{	
	foreach (<FHR>)
	{
		#print;
		s/ //g;
		@params = /[^,]+/g;
		
		#create config spec file
		if (open FHW, '>cs.txt')
		{
			print FHW "element * $params[1]\n" ;
			print FHW "element * /main/LATEST\n";
			$a=`cleartool setcs -tag $vt cs.txt`;

			$FILE_SEARCH="$params[0]" . "\.sql";
			our $fscript1=`cleartool find $ucm_path/$params[2] -version "lbtype_sub($params[1])" -name $FILE_SEARCH -print`;
		        @fscript2=split('@@', $fscript1);
			print STDOUT "script name is $fscript2[0]";
			$path_name = $params[2];
			mkpath("$path_name");
			

		}
		else
		{
			print "write unsuccesful\n";
		}
		close ( FHW );
	}
close ( FHR );
}
else 
{
 print "file open unsuccesful";
}

What is the value of $file_path when you pass it as an argument to mkpath? To find out, insert the following statement in your code immediately before the statement that calls mkpath. print "Here is the path name to pass to mkpath:\n$path_name\n";#For debugging only Also I recommend that you include the statements

use strict;
use warnings;

at the beginning of your script and then fix the warnings and error messages that result from the strict and warnings modules.

This article has been dead for over six months. Start a new discussion instead.