switch ($response_code) { case '200' { # OK print_response $response_content; exit 0; } case '400' { exit 1; } # BAD_INPUT case '403' { exit 31; } # SERVICE_ACCESS_ERROR case '500' { exit 32; } # SERVICE_EXECUTION_ERROR case '503' { exit 30; } # SERVICE_ERROR else { exit -1; } } #### for ($response_code) { if ($_ == 200) { # OK print_response $response_content; exit 0; }; $_ == 400 and exit 1; # BAD_INPUT $_ == 403 and exit 31; # SERVICE_ACCESS_ERROR $_ == 500 and exit 32; # SERVICE_EXECUTION_ERROR $_ == 503 and exit 30; # SERVICE_ERROR exit 255; }