#!/usr/bin/perl -w use strict; while ( (print "Enter Date: "), (my $date =) !~ /^\s*q(uit)?\s*$/i ) { next if $date =~ /^\s*$/; # reprompt on blank line chomp($date); if ($date =~ m|[^\d/]|) { print "Valid date has only digits and /!\n"; next; } #....more valdiation here .... #then actually do something before reprompting }