in reply to Re^2: alpha numeric comparision
in thread alpha numeric comparision

I have 3 variables,I want to compare those 3 based on a particular logic

All i want now is the variables are alpha numeric, i tried regex but i am unable to achieve the above

Hope i get a guiding light.

Prad

Replies are listed 'Best First'.
Re^4: alpha numeric comparision
by Jasper (Chaplain) on Jan 28, 2005 at 17:14 UTC
    This doesn't help. Post some examples of values for the variables, and what the results of the 'comparison' would be.
Re^4: alpha numeric comparision
by nobull (Friar) on Jan 28, 2005 at 17:38 UTC
    I have 3 variables,I want to compare those 3 based on a particular logic All i want now is the variables are alpha numeric, i tried regex but i am unable to achieve the above

    Your problem has nothing to do with Perl. You are trying to implement "a particular logic" in Perl but you are unable to describe that "particular logic" even in human language.

    You are making the common mistake of jumping ahead to how without first pausing at what.


    Hmm... I've just re-read what you said...
    All i want now is the variables are alpha numeric

    ...is that really all you are asking?

    To check that a string is alphanumeric with a regex

    !/[^[:alnum:]]/

    or if you don't want a negated regex

    /^[[:alnum:]]*\z/

    Note: only pedants use \z most of the time. Most people use $. Reading the manual to discover the subtle difference is left as an exercise for the reader.