in reply to writing to stdin

Here's one way to allow a user a lot of latitude in answering a yes/no question. This allows any answer other than one beginning with n or N to be interpreted as "yes".
print "Are you sure? [y]"; my $ans = <STDIN>; if ($ans !~ /^n/i) { print "Yes\n"; } else { print "Nope\n"; }