in reply to Re: chmod and oct
in thread chmod and oct

Thanks,

Than my first code was wrong, as it should be:

chmod 0755, $file; # and not chmod '0755', $file;
It is because my variable $chmod is regarded as a string and not a number, that is fails.

Why doesn't a trick like this work then?

$chmod='0644'; chmod $chmod+0, $file;
Please note that it is friday today, and this might explain my stuped questions :-)


---------------------------
Dr. Mark Ceulemans
Senior Consultant
IT Masters, Belgium

Replies are listed 'Best First'.
Re: Re: Re: chmod and oct
by dws (Chancellor) on Dec 06, 2002 at 08:55 UTC
    Why doesn't a trick like this work then?
    $chmod='0644'; chmod $chmod+0, $file;
    It doesn't work because "leading zero means octal" applies only to numbers, not strings of numeric digits.

    Try this:   print 0644, " != ", '0644' + 0, "\n"; This is all described in the on-line doc, in perldata.