set permission on file to 777

Here is the sample code I'm trying to execute. I see that the permission on the file is set to 755 always I want to change it to 777. Please help me with this.

code :

#!/usr/bin/perl


use File::Path qw(make_path remove_tree);

my $path = "2010/sam";
make_path($path,{mode=>0777});
ls -l
total 8
drwxr-xr-x 3 root root 4096 Jul  6 02:49 2010
-rw-r--r-- 1 root root  115 Jul  6 02:49 sam.pl


ls -l 2010/
total 4
drwxr-xr-x 2 root root 4096 Jul  6 02:49 sam

Though you use 777, according to the explanation at File::Path documentation,

  
the numeric mode to use when creating the directories (defaults to 0777), to be modified by the current umask. 

So as default your umask is 022, so you get 755 as permissions set.

1 Like