Copyright © tutorialspoint.com

PERL chown Function


Syntax

chown USERID, GROUPID, LIST


Definition and Usage

Changes the owner (and group) of a list of files. The first two elements of the list must be the numeric uid and gid, in that order. This funcation call works in similar way as unix command chown. Thus you should have sufficient privilege to change the permission of the file.

Return Value

  • Returns the number of files successfully changed.

Example

Here is an example which will change ownership for the given number of files.
#!/usr/bin/perl

$cnt = chown $uid, $gid, 'foo', 'bar';
chown $uid, $gid, @filenames;


Copyright © tutorialspoint.com