How can I use a variable to choose which Serial port to interact with?
You may use an array of pointers to the actual serial ports. For
example, on an Arduino Mega:

const size_t PORTS_COUNT = 4;
const HardwareSerial *ports[PORTS_COUNT] = {
    &amp;Serial, &amp;Serial1, &amp;Serial2, &amp;Serial3
};

void setup() {
    for (size_t i = 0; i &lt; PORTS_COUNT; i++)
        ports[i]-&gt;begin(9600);
}