generating users in perl

hi, i am trying to write a script to generate a big number of users in perl.. it is actually my second time writting perl .. i used to write shell scripts before. my short script seems not working because "useradd" isn't found by the compiler. if anyone may point out why it would be great. thanks.

#!/usr/bin/perl

$uName=$ARGV[0];
$uNumStart=$ARGV[1];
$uNumEnd=$ARGV[2];

for($i=$uNumStart; $i<=uNumEnd; $i++)
{
   useradd "$uName.$i" -g 999 -p password;  ## this line useradd not found
   `useradd $uName.$i -g 999 -p password; ##this line no error but users not added
   system(qq{useradd "$uName.$i" -g 999 -p password}); #this line acts the same as the above line
}

three 3 attempts didn't work. anyone has any suggestion would be great.

my next question is, how do i set the password? the -p will only give plain text password in the passwd file or shadow file, which is useless. if anyone could shed some light on this one too then it would be great. however, the first thing i really need to solve is the code above. Thanks

[/code]

for now

add the path of useradd in the argument to system function
here i've got: /usr/sbin/useradd

also check the return status of system call to see if it was successful

uh.. specifying full path wouldn't do it neither.

Maybe its a permissions problem.