Select Pool based on host header

I have several hundred websites that all use host headers in IIS. I would like to use a single virtual/Public IP address and have the traffic manager select the appropriate pool based on the host header passed in. I’ve been using a traffic script similar to the code snippet below. Is there a more efficient way to code this there will be several hundred pools and if statements? Can you do case statements in traffic script?

 

 

$HostHeader = http.getHostHeader();

 

if( string.contains( $HostHeader, "site1.test.com" ) ){
   pool.use( "Pool_site1.test.com_HTTP");
}else if( string.contains( $HostHeader, "site2.test.com" ) ){
   pool.use( "Pool_site2.test.com_HTTP");
}else if( string.contains( $HostHeader, "site3.test.com" ) ){
   pool.use( "Pool_site3.test.com_HTTP");
}else if( string.contains( $HostHeader, "site4.test.com" ) ){
   pool.use( "Pool_site4.test.com_HTTP");
}else if( string.contains( $HostHeader, "site5.test.com" ) ){
   pool.use( "Pool_site5.test.com_HTTP");
}else if( string.contains( $HostHeader, "site6.test.com" ) ){
   pool.use( "Pool_site6.test.com_HTTP");
}else{
   http.changeSite( "http://www.test.com" );  
}