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 | [reply] |
This doesn't help. Post some examples of values for the variables, and what the results of the 'comparison' would be.
| [reply] |
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.
| [reply] [d/l] [select] |