The problem is that you need a leading zero in order for a number in Perl to be interpreted as octal. That isn't explicitly mentioned in the chmod() documentation, and might not be clear if you don't already know it.