Please note the error (WRONG) below. Apologies.

------------------

#!D:\perl\bin\perl -w
use strict;

my %data;

# fill in 11 other states
my @state = qw(MA CI DE IN OH);    

# Make each element of @state a key of hash %data
# Set each value equal to 1 (true)
# Refer to Perl Cookbook
# Recipe 4.7: Finding Elements in One Array but Not Another
# WRONG !!!!!!!!!!!
# $data{ @state } = (1) x @state;
@data{ @state } = (1) x @state;

# Start loop here that reads each Access record 
   # Check if the present state is one of the 16 
   # $statefield is the state field of the ODBC
   # record object: $rs->Fields('state')->value
   # Refer to ActivePerl Help: Using OLE with Perl
   If ( $data{$statefield} ) {
   # OR If ( $data{uc($rs->Fields('state')->value)} ) {
      # Process data
   }

# End loop here that reads each Access record

-----Original Message-----
From: Ned Cunningham [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 11:46 AM
To: [EMAIL PROTECTED]
Subject: If statement


HI,
I am having a very newbie problem.
I am reading an Access database with ODBC and have my data read into

$Data{STATE}

My problem is now I need to match to 16 different states.



I have so far

If ( $Data{STATE} eq "MA" )

Process data


My question is should I use an array to test against and how to code it?

??-
@state="MA CI DE IN OH";

Thank you for anyhelp



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to