open my $fh, ">", "/whatever/path/you/need/Main/DIR2/file" or die; # Absolute open my $fh, ">", "../DIR2" or die; # Relative