use strict; use warnings; use File::Spec; my $path=File::Spec->catfile('C:',"Program Files","Microsoft Office","Office","Excel.exe"); print "\$path gives you: $path\n"; __END__ Output: $path gives you: C:\Program Files\Microsoft Office\Office\Excel.exe.