I couldn't resist posting this here -- even though it's at best a code snippet, and I'm less than a duffer, ranker than an armchair -- just cuz the context is so appropriate, in a self-referential sort of way. (Notwithstanding the inadequacies, at least it's short.)
It's a little script to download the cumulative "Cool Uses for Perl" pages and string them into one big page on my HD. Yeah I know. I should've filtered and scraped and WWW-Mechanize'd away all the duplicated headers and footers and sidebars and stuff. A rainy day perhaps ...
#! /usr/bin/perl -w use strict; use warnings; use LWP::Simple; my $url; my $doc; my $path = "http://www.perlmonks.org/?"; my $fn = "coolness.html"; open TO_FILE, ">> $fn" or die ": $!"; for (my $i=0;$i<300;$i+=15) { $url = $path . "next=" . $i . ";node_id=1044"; warn $url, "\n"; $doc = get($url); print TO_FILE $doc; } close TO_FILE;
(But I'm curious, maybe someone knows: could the for( ) loop be replaced by a while(< >) contruct? Looks a bit verbose, that $doc variable shunting inbound pages to the filehandle. Um?)
(Be kind. You were all once newbies too.)
Unconsidered by castaway - already been considered a few times, we're leaving it unapproved.
In reply to Cool Uses, re-used by nnvsnu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |