TPJ One-Liner #35If Dr. Seuss were a Perl programmerCourtesy of Kevin Meltzer
#!/usr/bin/perl
#
# Will give errors if run with -w, so don't use -w :)
# Tested on NT with AS (5.005), GS (5.004_02),
# and Solaris 2.6 (5.004_04)
if ("a packet hits a pocket") {
On: a;
socket(ON, A ,PORT,"")
&& the bus is interrupted as a very-last-resort
&& the address of the memory makes your
floppy disk, abort;
} else {
"The socket packet pocket has an";
error: to-report;
}
if ("your cursor finds a menu item") {
"followed by a dash"
&& "the double clicking icon";
puts: your-items-in-the-trash
&& your data is corrupted cause the
index("doesn't", "hash");
} else {
"Your situation is hopeless"
&& Your system's gonna crash;
}
if ("the label on the cable") {
On-the-table, at-your-house;
Says_the;
sub network {"is connected to the button on your mouse"};
BUT: Your-packets, want-to;
{/tunnel to another protocol/};
that's: repeatedly-rejected;
{/by the printer/}; "down the hall"
&& "YOUR SCREEN is all distorted";
{/by the side effects of Gauss/};
so: "your icons", in-the-window;
"are as wavy as a souse";
} else {
YOU: "may as well reboot" && "go out with a !";
CAUSE: /Sure as Im a poet/;
THIS: suckers-gonna-hang;
}
print "Seuss as a tech writer - Kevin Meltzer\n";
|
TPJ One-liner #36Neal Stephenson's latest novel, Cryptonomicon, includes a Perl cryptosystem code-named Pontifex. You can read about it at http://www.well.com/user/neal/cypherFAQ.html#12. |
TPJ One-liner #37Stripping the eighth bits from a string $s &= "\177" x length($s); Courtesy of Tom Christiansen |
TPJ One-liner #38Replacing tabs with spacesperl -0011 -pi -e '/\011/&&($_="$'")' filename Courtesy of Abigail |
TPJ One-Liner #39Printing all capitalized words perl -ne 'push@w,/(\b[A-Z]\S*?\b)/g;END{print"@w"}' file |