in reply to mkdir mode troubles

The "mask" argument to perlfunc:mkdir must be an *octal number*, so that leading 0 is important (tells Perl it's an octal, not a decimal, value).

Try it with '0777' instead and see what happens.

If you're the owner of those directories (which you should be), change their permissions on the command line with chmod -R 0755 Online_library/*. You can also use chmod within Perl (but mind the octal numbers!).

Finally, I'd bet the '??' goes away if you chomp each line before you feed it to mkdir.

HTH.

perl -e 'print "How sweet does a rose smell? "; chomp $n = <STDIN>; $r +ose = "smells sweet to degree $n"; *other_name = *rose; print "$other +_name\n"'

Replies are listed 'Best First'.
Re: Re: mkdir mode troubles
by merlyn (Sage) on May 15, 2001 at 18:15 UTC
    The "mask" argument to perlfunc:mkdir must be an *octal number*,
    No, it must be a numeric expression. We commonly express the number as octal, because those octal numbers have mnemonic value. But if you can calculate in your head that 0777 is the same as {firing up calculator...} 511 decimal, then just type 511 there, and it works just fine.

    The problem with writing 777 there is that it's interpreted as if it was 01411, which is interpreted by Unix as sticky bit, read-only for user, execute-only for group and others. Certainly not a good permission for a new directory.

    But let's kill this meme that this second parameter "must be octal". It must be a number, and we usually write it as octal because of the mnemonic value.

    -- Randal L. Schwartz, Perl hacker

(tye)Re: mkdir mode troubles
by tye (Sage) on May 15, 2001 at 21:25 UTC

    Try it with '0777' instead and see what happens.

    Okay:

    #!/usr/bin/perl -w print 0777, $/; print 0+'0777', $/; printf "0%o\n",0777; printf "0%o\n",'0777';
    produces
    511 777 0777 01411

    Okay, so you probably didn't mean for me to type in the single quotes. But I thought this was a subtle and sometimes important point. The string '0777' is silently (no warnings) interpretted as the decimal value 777, not the octal value 0777.

            - tye (but my friends call me "Tye")