Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Fetch some meditation material

by TheoPetersen (Priest)
on Feb 20, 2001 at 23:40 UTC ( [id://59744]=perlcraft: print w/replies, xml ) Need Help??

   1: #!/usr/local/bin/perl -w
   2: 
   3: use strict;
   4: use LWP::Simple;
   5: 
   6: $_ = get("http://classics.mit.edu/Lao/taote.mb.txt")
   7:   or die "The page that can be fetched is not the true page\n";
   8: my $chapter = 1 + int(81 * rand());
   9: my $end =
  10:   $chapter == 37 ? '\n-------' :
  11:   $chapter == 81 ? '\nTHE' :
  12:   ('\nChapter\s+' . ($chapter + 1). '\s*\n');
  13: /^(Chapter\s+$chapter\s*\n.*?(?=$end))/ms && print $1;

Replies are listed 'Best First'.
Re: Fetch some meditation material
by spaz (Pilgrim) on Feb 21, 2001 at 02:58 UTC
    I don't usually reply to Craft because...well it's Craft and usually Craft's aren't that cool, but this just blew my friggin mind! Not that the Perl isn't graceful, but what a great idea.

    -- Dave
      I concur with spaz on that one, that craft's generally aren't that rockin' but hey, this one actually is cool!! I think any Perl hacker/programmer in perlmonks.org that enjoy's cool little progs and so on, should check this one out for it is cool :-)
Re: Fetch some meditation material
by providencia (Pilgrim) on Mar 20, 2001 at 01:10 UTC
    This was so cool. I use it in my bash login script.

    ...wonder if they have the dhammapada?
Re: Fetch some meditation material
by Stormshadow (Initiate) on Apr 18, 2001 at 18:44 UTC
    Loved it! Useful script, and its code I might actually be able to decipher. (being new and all)

    -Perl too is part of the beauty of the 10,000 things.

Re: Fetch some meditation material
by jgchilds (Initiate) on May 03, 2001 at 09:52 UTC
    Very cool!!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-20 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found