mkdir "c:/configs/".$RackID or die "mkdir failed: $!"; open ERROR,">c:configs/$RackID/AP Compare results.txt" or die "open failed: $!"; ...