in reply to
How to close command prompts opened with perl script after execution that script
Starting the cmd windows as you are, it is difficult to kill them as you don't have a handle or PID for them.
If your commands are unique enough, you might use taskkill to kill the processes.
You could use Win32::Process to start the command processes then terminate them, something like:
my $cmd = 'dir';
#system("start cmd.exe /k $cmd");
"cmd.exe /k $cmd",
NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE,
sleep(10); # do other stuff