# Replace the if/elsif block inside mce_loop with the following # Fill worksheet rows/cells if ($region eq 'AMS') { $wb = init_wb(0); $ws = $wb->sheets(0); $ws->write(0, 2, 'foo', $format); for my $row (1..1e6) { for my $cell (0..19) { $ws->write($row, $cell, $row + $cell + 10e6); }} print "AMS ---- DONE.\n"; } elsif ($region eq 'APJ') { $wb = init_wb(1); $ws = $wb->sheets(1); $ws->write(0, 2, 'bar', $format); for my $row (1..1e6) { for my $cell (0..19) { $ws->write($row, $cell, $row + $cell + 20e6); }} print "APJ ---- DONE.\n"; } elsif ($region eq 'EMEA') { $wb = init_wb(2); $ws = $wb->sheets(2); $ws->write(0, 2, 'baz', $format); for my $row (1..1e6) { for my $cell (0..19) { $ws->write($row, $cell, $row + $cell + 30e6); }} print "EMEA ---- DONE.\n"; }