In your case, the external program does exactly what you want, and you'd need more perl code to get the job done. So calling /bin/chown is fine.
(BTW, you should probably hardcode the path to chown in your call, in case your path gets messed up, or someone has the chance to drop a hostile executable script named chown upstream of /bin in your path, for instance. I don't know what context this script runs in.)
However, keep in mind that your script now depends on /bin/chown. I admit it's unlikely that the interface to chown will change, but it's something to keep in mind if you call external programs.
Obviously, if you'd had to chown only certain files, then using the "perl perl" approach along with the File::Find module would probably be a better choice.
--
Mike
In reply to Re: system or perl function ?
by RMGir
in thread system or perl function ?
by tbo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |