title: A perl (or C) program to change password in Unix?
body: <p>hi i am trying to do <a href="https://stackoverflow.com/questions/714915/using-the-passwd-command-from-within-a-shell-script?lq=1">this</a> as mentioned in the answer using perl but it's not working.</p>
  
  <pre><code>#!/usr/bin/perl -w
  $pipe="data";
  $username="mukesh";
  $password="mukesh";
  open my $pipe, '|chpasswd' or die "can't open pipe: $!";
  print {$pipe} "$username:$password";
  close $pipe
  
  [root@testgfs2 user_mgmt]# ./tess3.sh
  Name "main::pipe" used only once: possible typo at ./tess3.sh line 2.
  chpasswd: line 1: line too long
  chpasswd: error detected, changes ignored
  </code></pre>
  
  <p>can any body suggest.whats wrong.</p>
  
  <p>since --stdin is not avalable on all *nix i am trying to use this</p>
  
  <p><strong>EDIT</strong> : Is there any program in C to do this.cause that maigh be usefull for all versision if *nixes</p>