my $basedir = 'results'; my $tempname = "${basedir}/output/file.txt"; open my $oh1, '>', $tempname or die "$!"; open my $oh2, '>', "${basedir}/output/file.txt" or die "$!";