Tuesday, May 12, 2015

Write a perl program to read username and password from user without displaying the password string.

#!/usr/local/bin/perl

use strict;
use warnings;

print "Please enter you credentials \n";
print "login:";
my $usr_nm = <STDIN>;
print "password:";
system('stty', '-echo');
my $pswd = <>;
system('stty', 'echo');
print "\n";




Output:
./login.pl
Please enter you credentials
login:user_name
password:

No comments:

Post a Comment