title: how to create add user to linux machine with perl script
body: <p>I've searched for some hint about this one but I'm  clueless</p>
  
  <p>I'm trying to add a user to a linux machine with perl
  code :</p>
  
  <pre><code>my $md5password = `openssl passwd -1 $password1`;
  system("useradd -s /bin/bash -d /home/$username -p $md5password");
  </code></pre>
  
  <p>but this is resulted in :
  <code>sh: 2: -p: not found</code></p>
  
  <p>when I'm executing this commands via terminal there's no problem...
  arrr!
  anyone?</p>
  
  <p>update:</p>
  
  <p>10x to @BraveNewCurrency advice it work's :)</p>
  
  <p>code:</p>
  
  <pre><code>if(($password1 eq $password2) &amp;&amp; length($password1) &gt; 0)
  {
      $valid = 1;
      my $md5password = `openssl passwd -1 $password1`;
      chomp($md5password);
      system("useradd -s /bin/bash -d /home/$username -p \'$md5password\' $username");
  </code></pre>
  
  <p>I will look more into sanitizing <code>$username</code> later on.</p>
  
  <p>I cant upvote @BraveNewCurrency cause my rep is under 15 ...I will be glad if some of you will upvote him.</p>