Name: Anonymous 2009-03-11 20:21
Is it just me or are programmers always trying to use the most obfuscated code possible?
I'm not familiar with other programs, but this routinely seems to be the case with Perl programmers.
I was having some issues with taint mode and went online to search about my particular problem. One person posted this solution:
When he could have simply done:
And they both work! Why all the extra shit? And this is just an example, but I always find ways in which code could be shortened. Am I doing it wrong?
I'm not familiar with other programs, but this routinely seems to be the case with Perl programmers.
I was having some issues with taint mode and went online to search about my particular problem. One person posted this solution:
$string=do_untaint($string);
sub do_untaint {
unless ($string =~ m/^(\w+)$/) { #allow filename to be [a-zA-Z0-9_]
die("Tainted");
} return $1;
}When he could have simply done:
if($string=~/^(\w+)$/){$string=$1;}And they both work! Why all the extra shit? And this is just an example, but I always find ways in which code could be shortened. Am I doing it wrong?