>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes:

  SB> # STRINGS
  SB> case /^(comment|plan_type|description|desc|started|
  SB>         billing_address1|billing_address2|shipping_address1|
  SB>         shipping_address2|billing_company_name|shipping_company_name|
  SB>         shipping_town|billing_town)$/x

  SB> This is becoming extremely boring and tedious, as I have eight or nine
  SB> similar but different case statements. I haven't been able to figure out
  SB> a way to do this that will save me any time or work. Any suggestions on
  SB> how I can classify the keys in a better (ie less boring and eye popping)
  SB> way?

you are going to hate me for this. the tool you just learned, dispatch
tables are perfect for this. you are matching full tokens so no regex is
needed. you have multiple sets of keys and you can point them to the
same code ref (you can use an anon sub as they are short chunks of
code).

i told you dispatch tables are very useful!

i leave how to code it as an exercise for you.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to