I humbly submit that the "array" definition and subsequent code will never do what is desired:
my @wtodays= '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'; for ( @wtodays ) { $table->addRow(split(/\s+/, "$_\n")); }
The array is being assigned a single string constant as if it was a scalar. The data in the array must first be organized properly before any meaningful manipulations can be done with it. For example:
my @wtodays = ( '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', ); for ( @wtodays ) { # do whatever text processing you need on a single row }
And yes, if there are tabs between the column data, and spaces only occur in the column values, then the split becomes trivial once the array is properly defined.
Update: grammar correction in previous paragraph.
In reply to Re: Regex for non-patterned input
by boftx
in thread Regex for non-patterned input
by sidsinha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |