It's an interactive application so speed during a
prompt for data is virtually a non-issue. And if
the first one works why the desire for a different
solution? What does the 2nd give you over the 1st?
> print "Please enter the string: ";
> $Response = <STDIN>;
> chomp $Response;
> if ($Response !~ /^\w+$/) {
> warn "Error - string not valid.\n";
> }
>
> Can someone show me a more elegant way of validating user
> input than this:
>
>
> print "Please enter the string: ";
> $Response = <STDIN>;
> chomp $Response;
> if (($Response =~ /\W/) || ($Response eq "")) {
> warn "Error - string not valid.\n";
> }
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs