foreach $line ( ) { if( $line =~ /^Name/ ) { @columnNames = split(/\t/, $line); } else { push @rowValues, [ split(/\t/, $line) ]; } } #### $row = 0; $count = 0; foreach $element(@columnNames) { $worksheet->write($row,$count,$element); $count++; } ++$row; foreach my $rv (@rowValues) { $count = 0; foreach my $element (@$rv) { $worksheet->write($row,$count,$element); $count++; } $row++; }