Perlfunc: confirm
sub confirm() {
my $yes_default = shift();
my $display_text = shift();
my $yes = "y";
my $no = "n";
if ($yes_default) { $yes = uc($yes); }
else { $no = uc($no); }
$display_text ||= "Confirm";
print "$display_text ($yes/$no): ";
chomp(my $confirm = <STDIN>);
if (!$confirm) { return $yes_default; }
elsif ($confirm =~ /^y/i) { return 1; }
else { return 0; }
}