#! perl -slw use vars qw[$required]; use strict; sub abstract (\$$) { my ($data, $req) = @_; my ($s, $p) = (0, 0); while ($p < $req) { $$data =~ /[^<]{1,${\($req - $p)}}/gc; last if ($p += pos($$data) - $s) >= $req; my ($q) = $$data =~ /\G[^"'>]+(.)/gc; #!" $$data =~ /\G[^$q]+/gc if $q =~ /["']/; #!" $$data =~ /\G[^>]+/gc; $s = ++pos($$data); } $$data =~ /\G[\w]+/gc; return substr( $$data, 0, pos($$data) ); } my $data = join '', ; $data =~ tr/\n/ /d; print abstract( $data, $required||40 ); __DATA__ A story on GettingIt about hacking polls. Contrary to what the article says, Time is not checking for multiple votes on their poll. And I'm happy to report that despite the fact that my cheater scripts aren't running, I'm still beating Bill Gates. Some more test data.
ThingsValues
A thingA value