do { chmod($filemode, $_) if (-f $_) } or warn $!; do { chmod($dirmode, $_) if (-d $_) } or warn $!;