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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.