my $password; do { # theoretically it can get stuck in an infinite loop here... $password = mkpasswd(); } while( $password =~ m/\"|\'/ );