Since you indicate code from Linux is ok for you too:
use warnings; use strict; use File::stat; use Fcntl qw/S_IMODE/; my $filename = $0; # just for testing my $stat = stat($filename) or die "stat $filename: $!"; my $perms = S_IMODE($stat->mode); printf "%#0o\n", $perms; chmod $perms, $filename or die "chmod $filename: $!";
In reply to Re: [Cygwin] Setting and getting file permissions as octal numbers
by haukex
in thread [Cygwin] Setting and getting file permissions as octal numbers
by syphilis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |