Replace switch() statement with give/when in perl scripts