Hi, The best approach you go with is use regular expressions, rather that comparing them using relational operators.
next unless($fieldValue =~ /(\W|\D)+/); the above code will check if '$fieldValue' is a non alpha numeric and starts the next iteration if it is not. \W in the above code specifies a non-word, \D specifies a non-digit and + specifies for one or many. since Perl is a TIMTOWTDI, i have give you one way. but it is always good to go with regular expressions rather than relational operators for matching characters. (FYI, i love Reg Exp's :) jus kidding) hope this helps. Note: i have just given you an example, which may not exactly suit your requirement, you have to change it :). i have just given you a hint. Ashok On 8/31/06, Owen <[EMAIL PROTECTED]> wrote:
On Wed, 30 Aug 2006 15:44:53 -0700 (PDT) "Mary Anderson" <[EMAIL PROTECTED]> wrote: > > Hi All, > I know this isn't strictly a cgi problem, but it is arising in a cgi > application. I have a loop which reads certain fields, hashed on names. > Some of my fields hold character strings, some hold numbers. Sometimes > the number field is a blank. I need a test on the field value $fieldValue > which will tell me if my field was blank regardless of whether it holds a > character string or a number. > > I would like to say something like > > $fieldValue = (($fieldValue == 0) or $fieldValue) ? $fieldValue : 'null' > > but perl appears to have a strange interpretation of $fieldValue == 0 if > $fieldValue is a character. > > Thanks > Mary > > I have seen references to a function which will do the trick, but it > is not mentioned in the camel book. You need to use 'eq' or 'ne' for strings. 0 isn't a string. So you have to rethink your logic Look up comparison, relational and equality operators. Try perldoc perlop (not sure) Owen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>