Clever. I liked the idea of going to another site to pull in the text. Too bad that "Just" had to be hardwired. Perhaps scraping from Google would yield more suitable text, though keeping the spirit of Perl by going straight to the Monastery Gates is a hoot.

Not sure that it's strictly within the relm of traditional JAPH's. But then again, part of the principle of a good JAPH is to think outside of the box. Certanly some of mine have broken a few of the rules-of-thumb (4-line size limitation often being the first rule to go). The biggest complaint would be using a module, which implies importing a bunch of code. But then again, it *is* a standard module, so why not.

I wanted to see if I could get your JAPH to fit into four lines. It may be possible with more of a rewrite, but I tried to maintain similar strucure and flow. Here's the outcome (longer than 4 still, but I've managed to cut it down to 7 lines from 14, and maybe just a little smoother... maybe not).

use IO::Socket;$_='www.perlmonks.org';$et='IO::Socket::INET'-> new('Proto','tcp','PeerAddr',$_,'PeerPort','80','Timeout',10); die unless $et;$et->autoflush(1);print $et "HEAD / HTTP/1.0\nHost: $_\n\n";while(<$et>){$l=$_ if /Perl Monks - The Monastery Gates/}@a=('Just',' ','cke'); for(qw/26,1 25,1 24,1 19,3 8,1 6,4 20,1/){($b,$c)=split/,/; push@a,substr($l,$b,$c)}print@a[0,1,3..7,1,8,1,9,3,2,7],$/
I really liked your idea, which is why I tinkered with it further. At first run, I thought you'd hung my system when it sat there for 20 seconds waiting for the host. ;)

Thanks for the fun.

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein


In reply to Re: HEAD / HTTP/1.0 by davido
in thread HEAD / HTTP/1.0 by supa

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.