in reply to If/Else or Unless Not Triggering Correctly
As a matter of style, I prefer to use a hash to figure out whether something is in a set, or not. So your code would be simplified to the following:
Using 'data' has a variable name is amusing -- you can probably find a better name than that. :)sub triggerNotification { my ( $data ) = @_; my %message_classes = ( 'ARCHITECH' => 1, 'CURR-LIB' => 1, 'MARKET_PL' => 1, ); if ( not exists $message_classes{ $data } ) { # Send an E-Mail notification if the message type is not listed. } }
|
|---|