You're on linux? Im booted into windows, but anyway, are you trying to build directories in /home? If so try "/home/folder1/folder2/folder3/folder4" im pretty sure that you would need to use native 'mkdir' command to use '~/'
EDIT: Use '~/' like this: 'mkdir -p ~/one/two/three'. I do not see any references to File::Path supporting or NOT supporting '~/'. So maybe someone else can chime in about this. :)