#79 not printing to std out untill code finnished..

open
nobody
5
2014-08-23
2009-05-23
Anonymous
No

i am very green when it comes to perl and hence trying to learn using some test scripts on the net as below

the script works but.....
ideally it should prompt you for a password?
but you get nothing to std out intill the script is finnished..
here is the output for the below script with two wrong passwords and the correct one....
###
jhg
jkhkjh
fredPassword? sorry. Again? sorry. Again?
###

#!/usr/local/bin/perl
print "Password? "; # Ask for input
$a = <STDIN>; # Get input
chop $a; # Remove the newline at end
while ($a ne "fred") # While input is wrong...
{
print "sorry. Again? "; # Ask again
$a = <STDIN>; # Get input again
chop $a; # Chop off newline again
}

hope this helps, thankyou ...

keep up the good work...
Phil

Discussion