#!/usr/bin/perl -w use strict; use Getopt::Std; use POSIX qw//; my $what; $| = 1; my @hosts; my %opts; while () { chomp; push(@hosts, $_); } getopts(':dw', \%opts); $what .= ' bla' if $opts{'d'}; $what .= ' blabla' if $opts{'w'}; my $cterm = POSIX::ctermid(); if (! $cterm) {die "No controlling terminal to read prompt from!";} if (! open(CTERM, '<', $cterm)) { die "Couldn't open controlling terminal $cterm: $!"; } print "OK? [Y|n]>\n"; my $yesno = ; chomp $yesno; exit 1 if $yesno =~ /^[nN]$/; print "Did not stop, sorry!\n";