June 20th, 2013, 04:50 PM
Originally Posted by Fullmetal99012
while ($answer ne 'y' && $answer ne 'n')
print "invalid response, Overwrite file(y/n)?";
$answer = <STDIN>;
I have this loop in my program, but no matter what I put in, it won't exit the loop. How would I fix it?
Chomp $answer, otherwise it will never be equal to y or n, but to y or n with a carriage return.
EDIT: Oops, I did not see that Fishmonger answered the same thing before.