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 commandchown. 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;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s