I have a question related to copying a string variable in perl.

 Actually in my program iam splitting the entries of /etc/shadow file,
and 

storing the first two fields i.e username and password in a variable,
and 

 i want to write this variable to /usr/local/cvsn/CVSROOT/passwd file
, inorder to give priveleges  to users to access cvs.

 I used the syswrite function but didn't work, can u plz help me
regarding this.

 This is how i tried the above said statements :

 The first part includes opening the /etc/shadow file and read the
last entry of the /etc/password file and storing it in default
variable, and splitting the password entry

 my @fields = split(/:/, $_);

#print ("$fields[0]\n");

#print ("$fields[1]\n");

$pass = join(':', $fields[0],$fields[1]);

print ("$pass\n"); # It prints the username and password with :
between them

#my $MYFILE = '/usr/local/cvsnt/CVSROOT/passwd';

syswrite ('/usr/local/cvsnt/CVSROOT/passwd', $pass, 60);

and also i tried this way 

my $MYFILE = '/usr/local/cvsnt/CVSROOT/passwd';

syswrite ($MYFILE, $pass, 60);


How should i go about it , plz let me kno.

 Thanks in advance

 
  


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to