sub validate_file { my $file_ok = 0; while (not $file_ok) { $file_ok = 1; # Let's assume the file has no error open( MY_FILE, $my_file ) or die "Unable to open file\n"; while( ) { chomp( $_ ); unless ( $_ =~ /^[a-z]/ ) { close( MY_FILE ); print "Error at line $.\n"; print "$_ does not begin with a lower case letter\n"; print "Hit return to continue: "; ; &edit_file( $my_file ); $file_ok = 0; } } close( MY_FILE ); } return 1; }