$_ = ' ---------- ------------------------- -------- ---- ------------------------- ----- ---- ----------- -----------'; my $i; print $i += length $_, $/ for split /(?<=-)(?=\s+|$)/; __END__ __OUTPUT__ 13 40 50 56 83 90 96 109 122