@dirs = split qr{[\\/]}, $path; $file = pop @dirs unless -d $path;