sub ch_acl{ my ($root, $user, $diritto)=@_; ##$diritto means $right my $ok = undef; $diritto = 'M' unless defined $diritto; die "What you are trying to do?" unless $diritto =~/[R|W|C|F|M]/i; print "********************************icacls $root /T /grant:r $user:(OI)(CI)$diritto\n\n"; while (!$ok){$ok = &test_my_command($root, $user, $diritto)} print "\n*** PERMISSION SET CORRECTLY\n"; } sub test_my_command{ my ($root, $user, $diritto)=@_; my $output = `icacls $root /T /grant:r $user:(OI)(CI)$diritto 2>&1`; if ($output =~ /No mapping/si){print "No mapping..\n";sleep 1;return undef} else{print "OK\n$output";return 1;} }