#!/usr/bin/perl use strict; use warnings; my $temp_file = $ENV{'APPDATA'} . '\test file name.tmp'; #$temp_file = '"' . $temp_file . '"'; # not needed, because open() isn't bothered by spaces in the name print "|$temp_file|\n"; open(my $fh, '>', $temp_file) or die "Error opening $temp_file $!\n"; print "worked!\n";