#!/usr/bin/perl -w use strict; use Getopt::Std; my $what; $| = 1; my @hosts; my %opts; while () { chomp; push(@hosts, $_); } getopts(':dw', \%opts); $what .= ' bla' if $opts{'d'}; $what .= ' blabla' if $opts{'w'}; print "OK? [Y|n]>\n"; my $yesno = ; chomp $yesno; exit 1 if $yesno =~ /^[nN]$/; print "Did not stop, sorry!\n"; #### $ echo -e "aaa\nbbb\nccc\n" | script.pl -d OK? [Y|n]> Use of uninitialized value in scalar chomp at script.pl line 23, line 4. Use of uninitialized value in pattern match (m//) at script.pl line 24, line 4. Did not stop, sorry!