while ( 1 ) ## You may prefer while ( 1==1 ) { Do your stuff . . . elsif ( $type eq '' ) { last; } else { ... notify of input not correct and show what's acceptable . . . } }