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