Not really sure if this should be listed as an obfu or a CUFP, as it really does have qualities of both. On the one hand,
it's sorta kinda unreadable, and certainly not what you'd expect a "Hello World" program to be like. On the other, it
demonstrates perl's usefulness and power when dealing with regexps and alternate data sources.
I had this idea when I first started out in perl, but hit too many snags at that time. It's only just now, when I was cleaning
out my fileshare, that I found and finished it.
#!/usr/bin/perl
open(FILE,"$0");
while (<FILE>) { print if $_ =~ s/[^H]*(H)[^e]*(e)[^ll]*(ll)[^o]*(o)[^
+ ]*( )[^W]*(W)[^o]*(o)[^r]*(r)[^l]*(l)[^d]*(d).*/$1$2$3$4$5$6$7$8$9$1
+0/; }
close(FILE);
Spacewarp
DISCLAIMER:
Use of this advanced computing technology does not imply an endorsement
of Western industrial civilization.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.