[Chicago-talk] Sharing my pain

Shawn Carroll shawn.c.carroll at gmail.com
Fri Oct 13 13:01:55 PDT 2006

I have a colleague who is a python developer.  He and I rib each other
on our choice of languages, good natured stuff.  We are working on
porting some unsupported code to python in support of a business
initiative.  We came accross the lovely code below.  He said this is
the kind of code people talk about when they say perl isn't a great
language.  After reading it, if this indicative of some perl out
there, I'd have to agree.

We have made it anonymous to protect the guilty.

sub findSprokets {
     my $sprokets = '';
     my @tmp;

     $sproketDat = "/tmp/sprokets.dat"

     my $sproketAccum = qx(cat $sproketDat);
     $sproketAccum =~ s![\n\s\t]!!g;
     @tmp = split(/\+;/, $sproketAccum);
     foreach (@tmp) {
         unless (m!foobar!) { s!^foo!!g }

     my $sp;
     foreach $sp (@tmp) {
         $sp =~ s!\\!!g;
         $sp =~ s!\n!!g;

         if ($sprokets) { $sprokets .= ' ' }
         $sprokets .= $sp;
     return $sprokets;

my $tmp = findSprokets();
@sprokets = reverse sort( split(/ /, $tmp) );

shawn.c.carroll at gmail.com
Perl Programmer
Soccer Referee

More information about the Chicago-talk mailing list