Page 1 of 1

Perl Programming humour for the geeks..

Posted: 30 July 03 2:16 pm
by Two Goth Geeks

Some of my favourites:

How do I clear the screen?
Use this function:

sub clear_the_screen {
print $ x 1_000_000;

What's a regular expression to replace 09:23:53 08-OCT-98 with Thu Oct 8 09:23:53 1998?
s{.*}{Thu Oct 8 09:23:53 1998}

How do I get tomorrow's date?
Use this function:

sub tomorrow_date {
sleep 86400;
return localtime();

How do I block warnings?
The simplest way is to do

close STDERR;

How do I get my perl program to run faster?
In Perl, there's always more than one way to do it. Try one of these techniques.

use more 'cpu';
use less 'time';
use more 'speed';
## or, the ever popular Military Marching Band accompaniment:
use March::Sousa qw(:DoubleTime);
The March::* hierarchy is not found on CPAN. Please contact the author for more information.

Alternatively, programs have been known to complete more quickly when they contain a declaration like this one:

BEGIN {exit}
If your application is truly urgent, you might try the experimental

no more 'time';
feature, but this has been reported to cause some systems to panic.

Perldoc isn't running properly. Where can I find the documentation?
perldoc perldoc

I have a lot of Bourne shell scripts I'd like to convert to Perl... What's the easiest way to do it?
Make sure that the first line of your script is #!/bin/sh. That magic comment tells the Perl interpreter to understand Bourne shell syntax.

I've got a C program I want to translate to Perl... How do I do that?
If you're using gcc, version 2.7 or better, you can use the translate-to-perl mode.

gcc -P -E foo.c >
(gcc is smart enough to figure out that you want to convert to 'perl' by specifying the 'p' and 'e' alone.)

For versions of gcc prior to 2.7, use

gcc -larry -Wall foo.c >

Posted: 10 May 04 8:23 pm
by Mix
I dont know pearl but as geocachers arenÂ’t we all geeks. <br>
new slogan "Geocaching: its a geek thing."

Posted: 10 May 04 11:01 pm
by dcr
My fav. is still camel code, I think that makes me a bit too Geek? :oops:

<br />
cheers Darren :)

Posted: 11 May 04 1:06 am
by Dingbats
Mix76 wrote:I dont know pearl but ...
Unfortunately I do, this reminded me why I switched to Python a few years back :P
On the topic of computers and programming languages, there is a lot of scope for an ultra geek computer nerd multi-puzzle cache. I'd be suprised if this hasn't been done. Can anyone point me to such examples?