my $firstrow = " "; my @columnpos; while ($firstrow =~ /(<\w>)/g) { push @columnpos, pos($firstrow) - length($1); } print "positions: @columnpos\n"; __END__ positions: 0 30 47 57 68 78 82 88 101 111 121 128