On Friday 16 July 2004 14:51, Mike Blezien wrote:
>
> hello,

Hello,

> I have been given some programming code that I need to convert or
> translate into perl coding, and I was hoping someone on this list
> maybe able to help me out. I have a vague idea what it's suppose to
> be doing, but some of it isn't real clear. Below is the psuedo-code
> sample
>
> ##### START CODING ##########
> str* are strings
> num* are some type of numerics, typically integers
> The algorithm needs basic functions like right(), left(), mid(),
> concatenate(), ASCII(), and
> modulus.  modulus is non-negative mod(7, 4) = 3 NOT -1.
>
> validate userID is greater than 3 characters and all ASCII character
> set.  Else, return error than invalid userID has been entered.  Is it
> possible to do this?

Certainly, according to the specification above:

if ( $userID =~ /\A[[:ascii:]]{4,}\z/ ) {
    print "$userID is a valid user ID\n";
    }
else {
    die "Invalid user ID: $userID\n";
    }


John
-- 
use Perl;
program
fulfillment


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to