Tuesday, August 14, 2007

Perl spart Zeit...

Gerade auf der Mailingliste von Sydney.pm:

> perl -e 'print int(rand(5) + 1),"\n"';
> 1

Years before Perl was invented, I was onsite and doing some tricky
development which involved the need for regular printouts. It was a pain
fetching the printout, so I wrote in shell a random name picker
similar to the one here, so that one of me or the two guys I was
working with would be requested to go and get the printout everytime
an lp command was issued.

I put my name at the end of the list, and then quietly changed
int(rand(3) + 1) to int(rand(2) + 1). One of the guys figured it
out after the next 6 printouts were all him and his mate, and demanded
I change it to int(rand(1)+1), after which neither of us had to fetch another
printout for a few days.


Das Shell-Skript lässt sich sehr leicht in Perl schreiben und so kann man mit Perl viel Zeit sparen ;)

No comments: