3 Jul
2003
3 Jul
'03
1:40 a.m.
markj@cloaked.freeserve.co.uk wrote:
I think the chmod doesn't need oct if it is given a number, so we should use chmod 0644, $file; rather than chmod oct(0644), $file;. Do we have someone who knows for sure, please?
Both are correct. The specific call to oct() is useful if the mode is stored in a variable, or is a string.[1] Removing oct() would be a micro-optimisation at best, and could potentially introduce a hard-to-track-down bug: 1. my $mode = 0644 ; chmod( $mode, $file ); 2. chmod( '0644', $file ); 3. chmod( 0644, $file ); You need oct() in the first 2 cases. dbkliv [1] - http://www.perldoc.com/perl5.8.0/pod/func/chmod.html