in reply to Strange way a string or array works

I changed your program as follows:
use strict; use WWW::Mechanize; use HTML::TokeParser; use Data::Dumper; my $webcrawler = WWW::Mechanize->new(); $webcrawler->get("http://www.marsh.com"); my $content = $webcrawler->content; my $parser = HTML::TokeParser->new(\$content); my @text_data; while($parser->get_tag){ push @text_data, $parser->get_trimmed_text(),"\n"; } print Dumper(\@text_data);
And it works as advertized.

BTW, You better not crawl/scrape Google as they don't like it very much: see "No automated querying" (external link).

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law