I have found the solution.Thanks

#!/usr/bin/perl

print "Enter your name : \n";
$username = <STDIN>;
print "Enter your password : \n";
chomp(my $password = <STDIN>);

$pass = crypt($password,"password");

system("useradd -m -p $pass $username");