#!/usr/bin/perl use strict; use warnings; use Benchmark; my $t0 = Benchmark->new; #use Spreadsheet::WriteExcel; use Excel::Writer::XLSX; my $filePath = 'D:\work\test.txt'; open(FILE,"$filePath"); my $workbook = Excel::Writer::XLSX->new('tab.xls'); my $worksheet = $workbook->add_worksheet(); my $row = 0; while (my $line = ){ chomp($line); # Split on single tab #print "$line\n"; my @Fld = split('\|', $line); my $cnt = scalar(@Fld); my $col = 0; while ($cnt>= $col){ $worksheet->write_string($row, $col, $Fld[$col]); $col++; } $row++; } my $t1 = Benchmark->new; my $td = timediff($t1, $t0); print "the code took:",timestr($td),"\n";