What does this mean in perl ?
my $dirPath = "/some/dir"
if (-d $dir_path && -r _ && -w _ )
{
}
I know what -d does but what about -w and -r and _ ?
From:
-r File is readable by effective uid/gid.
-w File is writable by effective uid/gid.
So -r
and -w
test if the file is readable. The underscore is a special handle that is used to ask perl to return information about the file specified in the most recent file test, which is -d $dir_path
in this case.
So your code tests whether $dir_path
is a directory for which we have read & write permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With