in reply to While loop

You can use last to jump out the loop when you get the input you want:
while(defined($input = <>))) { chomp $input; if ($input eq 'yes') { print "Yes entered for system.\n"; last; } elsif ($input eq 'no') { print "No entered for system.\n"; last; } }