c:\test>type temp.pl #! perl -sw use strict; my $filename = 'This_filename_has_2 2_spaces.txt'; my $tempstr = "echo \"$filename\" |"; printf "Below is the output of \'$tempstr\'\n"; open (IN,$tempstr) or die "Failed to echo $filename!\n"; printf "\t"; printf ; close (IN); c:\test>temp.pl Below is the output of 'echo "This_filename_has_2 2_spaces.txt" |' "This_filename_has_2 2_spaces.txt" c:\test>