mkdir expects an octal number for the mode. You might have beter luck with 0777. More information about the mode can be found in umask.
You can probably also get rid of the extra bits at the end of the directory names if you chomp each line of the file. I'll assume that the line ending is \r\n.