in reply to I need a "non-trivial" bug for my script!
More reasonably, take strict out, and put a typo or two in a variable name. Use a hash, and have a typo in the hash key somewhere. Generate a report, and have the header and the fields not actually match up. Deliberately create a bug in one place, then put a comment in another suggesting that something like that bug would exist for another reason. Have a log with something like a free-form text field in it (an Apache error log would work) and ask why the number of records from processing it with a correct program don't match the number of lines in the log.sub foo { my $condition = shift; my $some_var = generate_var() if $condition; # Use $some_var in an interesting way } # Elsewhere in code... foo(0); foo(1); foo(0);
These are all (including the nasty at the start) based on real problems that I have encountered while debugging code.
|
|---|