my $ffox = 'C:\Program Files\Mozilla Firefox\firefox.exe'; $ffox =~ s/\\/\\\\/g; #Replacing single \ with double \\ $ffox =~ s/\ /\\ /g; # Adding escape character before space chop($firefoxVer); # remove last \n chr. $ffox =~ s/$/\\\"/g; # With the below two commands, massaging the command to become $ffox =~ s/^/\\\"/g; # "C:\\Program\ Files\\Mozilla\ Firefox\\firefox.exe\" $firefoxVer = $ffox.' --version|'; # Adding "version|" to the above command $firefoxVer =~ s/$/\"/g; # and make it look like: $firefoxVer =~ s/^/\"/g; # "\"C:\\Program\ Files\\Mozilla\ Firefox\\firefox.exe\" --version|" open (IN, $firefoxVer) or die "Couldn't fork - $!\n"; ==> Fails