use strict; use warnings; my @array = (\&blue, \&foobar, \&no); do { eval {$_->() for @array}; } while $@; sub quit { print "Would you like to do that again? 'y' or 'n'\n"; die if =~ /y/; print "OK, done.\n"; exit; } sub blue { print "Type 'blue' to continue:\n"; return 1 if =~ /blue/i; quit(); } sub foobar { print "Cross your fingers and type 'foobar' to continue:\n"; return 1 if =~ /foobar/i; quit(); } sub no { print "To quit (prematurely), type 'no'\n"; exit if =~ /no/i; die; }