> perl $max_length=5; OUTER: { print "Input max is $max_length!!!\n"; while (1) { chomp( $input = ); last OUTER if lc( $input ) eq "end"; redo OUTER if length( $input ) > $max_length; print "- $input is OK\n"; } } __END__ Input max is 5!!! 1 - 1 is OK 12345 - 12345 is OK 123456 Input max is 5!!! 123 - 123 is OK end >