in reply to Sucking down a file

Yet another approach: Don't break the content into lines. while ($html =~ m/.../gis) { push @pos, pos $html; } #see the pos doc.