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

[Omaha.pm] use Switch 'Perl6';



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