$path = "c:\\foo\\bar\\perl.exe"; my($dir,$file) = $path =~ m/(.*\\)(.*)/; print "$dir | $file";