Kyle’s Reference Links

Contents External Links Friendly Links Marvin Links
Subject:      Re: TIP: How to post good questions
From:         mjd@op.net (Mark-Jason Dominus)
Date:         1998/06/28
Message-ID:   <6n69o5$7m6$1@monet.op.net>
Newsgroups:   comp.lang.perl.misc

In article <fl_aggie-2406981247580001@aggie.coaps.fsu.edu>, I R A Aggie <fl_aggie@thepentagon.com> wrote: >Repost, time..and yes, Olga, there *are* stupid questions.

Since I wrote that, I've found a few more. Right now the #1 on my shit list are the ones that invent some new syntax out of whole cloth, and then are puzzled when it doesn't work.

  • Why doesn't %h{@list} work?
  • Why doesn't ('foo', ('bar', 'baz')) work?
  • Why doesn't *#$*NJK@DN(D@HC work?

And gosh, it sure is hard not to be sarcastic here:

  • ``Because it's a syntax error.''
  • ``Because this is Perl, not Lisp.''
  • ``Because the computer can't read your mind. Guess what? We can't read your mind either.''
  • ``But it does work. It just doesn't do what you wanted. There is a difference, you know.''
  • ``If your problem is how to keep the computer from exploding when you do that, be sure to call the frobnitz() function.''

I think it must be something about the phrasing that gets me in the sarcasm gland.

It's so easy to fix these! The maxim here is


Cardinal Rule of Reporting Technical Problems

Never, never, never, never, never say `doesn't work'.

Never.

Proper Prophylaxis:

Just say ``I wanted X, but it does Y. How do I get X?''


By just including some tiny hint about X, you turn a stupid question into an intelligent one.

Here's an example from a couple of weeks ago:

>Why does this:
>
>    while ( ($k, $v) = each $this->{'stopped_content'}->{} ){
>        print       $v;
>       }
>not run?

Answer: ``Because it's a syntax error.''

Actually, the author here did do the right thing. The original text was:

>Why does this work:
>
>    foreach $key (@keys){
>        print $this->{'stopped_content'}->{$key};
>        }
>But this:
>
>    while ( ($k, $v) = each $this->{'stopped_content'}->{} ){
>        print       $v;
>       }
>does not run:

And then the answer becomes ``You should have used %{$this->{'stopped_content'}}''. See the difference here? One question can be answered; the other can't.

Here's another recent one:

>i get errors when i try:
>/BOB/d;

Answer: ``Yes, that's what's supposed to happen.''

I am happy to report that the original author did actually include X:

>i get errors when i try:
>/BOB/d;
>trying to delete all BOBs from my file

The answer is now clear: ``Use print unless /BOB/... blah blah or see perlfaq5 `How do I delete a line in a file' ''

I don't have many examples where the author really blew it, because I try not to answer those questions. I figure that even if I don't, someone else will come along and say ``Because you can't just make shit up and expect the computer to magically know what you mean, Retardo!''. And even if nobody does come along and say this, that's not a bad thing.

Well, here's one I was able to dig up from last month:

Xxxx Xxxxxx wrote:

> I've written a routine to get the file size of each file within a
> specific directory.
> however, it only works on particular files.  There doesn't seem to
> be a pattern either.  I'm using NT as a platform.
> Any suggestions ?

Dear Xxxx,

Perhaps your veeblefitzer is clogged.


Return to: Why Questions go Unanswered

mjd-perl-questions@plover.com

Valid XHTML 1.0 Strict! Valid CSS! Lovingly handcrafted with Vim