foreach my $vorwahl (@vorwahlen) { my $fmt_vorwahl = $workbook->add_format(left => 6, right => 1, bottom => ($rownum+1)%3 == 0 ? 1 : 0); $worksheet->write( $rownum++,$col, $vorwahl, $col%2 == 0 ? '' : $fmt_vorwahl); }