[Omaha.pm] use Switch 'Perl6';

Jay Hannah jhannah at omnihotels.com
Mon Nov 7 11:34:29 PST 2005


LOL! Really? Is that better than the original?

I didn't know there was such a thing...

j


-----Original Message-----
From: Kenneth Thompson 

Another fun way to write that...
 
use Switch 'Perl6';
[...]
given $prop_id {
 when (
/(AUSCTR|CANCUN|CHIDTN|CHOCHV|CLTDTN|CRPBFT|CRPTWR|DETDTN|INDSEV|MONDTN|
NYCBER|CHIAMB|OAEAST|JAXJAX|OMNIJH|STLDTN|OMNIST|HVNYAL|OMNNHY|ORFNEW|PH
LPHL|RICRIC|TUSNTL)/) {
   $connect_to_db = "hotel"; }
 when ( /(DALLBJ|PARKWE)/i ) {
   $connect_to_db = "dallbj"; }
 when ( /(HOUWST|HOUSHO)/i ) {
   $connect_to_db = "houwst"; }
 else {
   $connect_to_db = $prop_id; }
}




More information about the Omaha-pm mailing list