nayyreh atabakhsh wrote: > I am beginner at perl programming ,and I want to a > write a program that the user should not be allowed > to enter a blank name or answer. That is, continue > asking for their name until they type in at least one > character.
Use something like this: my $name; do { print "Enter your name: "; $name=<>; chomp $name; } until $name=~/\S/; print "I see, your name is $name!\n"; # and now do something with $name It will keep asking ask for name (the do{} block) until it gets any non white space character (the /\S/ pattern matches) in the answer (that way it will keep asking if someone enter only space or tabulator, etc.). chomp strips the newline ("enter") character at the end of $name. - RaFaL Pocztarski, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]