On Sunday, March 31, 2002, at 08:25 , Zeus Odin wrote:
> #!D:\perl\bin\perl -w
> use strict;
> my %data;
>
> # fill in 11 other states
> my @state = qw(MA CI DE IN OH);
> @data{ @state } = (1) x @state;
[..]

>    If ( $data{$statefield} ) {
>    # OR If ( $data{uc($rs->Fields('state')->value)} ) {
>       # Process data
>    }

way cool trick, but doesn't this still need to
have a 'Swithch like break out:

if ($data{$statefield} ) {
    #
    # Use a switch through
    #
    $_ = $statefield
    SWITCH: {

         /MA/ && do {
                        #do MA specific stuff
                        .....
                        last SWITCH;
         } # end do MA stuff

         /CI/ && do {
                        #do MA specific stuff
                        ......
                        last SWITCH;
         } # end do MA stuff

                .....

         die "Mr Wizard the stateField $statefield unguarded";

    } # end of switch

} else {
         # not in our state List
}

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


this way as the @state list grows or shrinks the one simply
adds in one more switch statement....

it's the 'last SWITCH' part that breaks it out.

The die is there fore the absurd case that while the
@state list was updated - someone forgot to specify
what to DO with that statement.... which of course
would not happen.... we all know.

ciao
drieux

---


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

Reply via email to