epike on Wed, 20 Feb 2002 11:54:29 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: help! (fwd)


> 

this probably could be true for all country = 'CA'

since

1. sub in_range( ..... $value == $low )
   is same as 'zip' == 'A1A1A1' is true (on my test machine anyway)

2. if (country..)
   evaluates to if (country eq 'CA' and true or true)


JondZ


> Can anyone help please. I have a routine that is supposed to capture a zip
> code if it falls in a range. It works fine with US zips, but not Canadian.
> Seems to capture any range for CA.
> 
> Can zip example:
> A0M 1P0
> 
> I'm passing a zip through this rule:
> if(country eq 'CA' and in_range(zip, 'A1A1A1', 'S9Z9Z9') or   in_range(zip,
> 'X1A1A1', 'Y9Z9Z9'))",
> 
> The Sub is as follows:
> 
> ########################################
> # in_range(value, low, high)
> #
> # Returns true if $value is gt $low and lt $high using lexographic
> # comparison.  Returns false otherwise
> #
> ########################################
> 
> sub in_range
> {
>     my($value, $low, $high) = @_;
> 
>     return(($low lt $value) && ($value lt $high) || $value == $low || $value
> == $high );
> }

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**


  • References: