in reply to Regex for non-patterned input
If your data has tabs/spaces/newlines where they should be, you can just split on the tab, and not just on any space, something like this:
#!/usr/bin/perl use strict; use warnings; use HTML::Table; my $table = new HTML::Table(-border=>0.2, -bgcolor=>'#F4F5F7', -head=> ['ColumnA','ColumnB','ColumnC', 'ColumnD', 'ColumnE']); + while ( <DATA> ) { my @row = split (/\t/, $_); $table->addRow(@row); } print $table; __DATA__ cOne cTwo cThree 13 sec cFour cOne cTwo cThree 11 sec cFour cOne cTwo cThree 1 min 2 sec cFour cOne cTwo cThree 13 sec cFour
|
|---|