Adam Turoff on Wed, 20 Feb 2002 11:17:05 -0500


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

help! (fwd)


----- Forwarded message -----
Reply-To: "William G. Zappasodi" <bz@CrestecDigital.com>
From: "William G. Zappasodi" <bz@CrestecDigital.com>
To: <phl@lists.pm.org>
Subject: help! 
Date: Wed, 20 Feb 2002 11:10:08 -0500
Organization: Crestec Digital

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 );
}

Thanks in Advance!


*******************
William G. Zappasodi
Crestec Digital
Web Production
bz@crestecdigital.com

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