This sent me off on a rant. This sent my manager and I off into a tailspin inventing god-awful code. My final contribution is nothing short of contrived ugliness, and I wanted to share it with you, my esteemed fellow monks:for ( @data ) { sysopen ($fh, "$log", O_WRONLY|O_APPEND); $fh->print ("$_"); close $fh; }
Since I'm dealing with the ugliness someone else unleashed on the world, somehow I feel better having unleashed that on the world, and it's better to do it here than in real code. This isn't about obfuscation, it's about just plain god awful code that does the job (in this case a version of 'cat'). A reminder of what we strive to not unleash on people. So make me cringe...show me your ugliness.#!/usr/bin/perl my $filename = $ARGV[0]; my @size = grep /./, map { $_ } split //, `wc -l $filename`; my $i = ''; my $loop = 1; while ( $loop ) { my $d = shift @size; if ( $d =~ /\d/ ) { $i .= $d; } else { $loop = 0; } } for ( 1 .. $i ) { my $line = `head -$_ $filename | tail -1`; print $line; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Plain old bad code
by grinder (Bishop) on May 20, 2006 at 10:10 UTC | |
by richill (Monk) on May 28, 2006 at 23:01 UTC |