"be consistent" | |
PerlMonks |
Re: ppkby merlyn (Sage) |
on Apr 18, 2005 at 02:16 UTC ( [id://448716]=note: print w/replies, xml ) | Need Help?? |
Two red flags, and some yellow flags, as follows:
First red flag: This code will get an incorrect $1 if the regex doesn't match. Never never Never look at $1 unless you've also tested the match. Oh, and that applies a few lines later too. At least you're consistently wrong. Second red flag: Never never never use kill -9 on a process, unless that process has resisted prior attempts to die via kill 1, 2, and 15. First yellow flag, back to the earlier code snippet: What's the /o doing there? {insert cricket chirp sound effects} Right, nothing. Doesn't hurt it, but it absolutely doesn't help it either. In fact, you should remove it universally in this program (I just noticed it earlier too). Second yellow flag... that sort screams for a Schwartzian Transform. Third yellow flag: Perl has a kill function. Why not use it instead of system'ing out? Conclusion: other than the bit about the Schwartzian Transform, the knowledge you are missing is contained within Learning Perl, which suggests that you read that book very soon. -- Randal L. Schwartz, Perl hacker
In Section
Code Catacombs
|
|