use strict; my $path = shift; $path =~ /^(\w):\\(.+)\\?/; print "Drive : $1, Top Level : $2\n";