in reply to parsing dynamic webpages

The LWP::Simple module does this quite nicely:
use LWP::Simple; my $content = get("http://perlmonks.org?node_id=18391");
Voila, the text of your query.