in reply to Re: Re: Sub call isn't returning values
in thread Sub call isn't returning values

As a beginner, I probably do treat programming as alchemy... especially when something isn't working, I try everything I can think of.
IMO, that's a very wrong thing to do. It won't teach you *anything*. If code works, or if you think it works just because it happens to produce the right output on a few test cases, it's just luck. It won't give you much insight.

Yes, I forgot to mention... I tried to print out spec_vars and it was empty after the second call to the page (which, of course, explains why variables later on in that second call are empty).
Well, that's a clear indication that your program isn't getting the data it's expecting. Not setting $|, calling the sub at a different time or cleaning the litter box aren't going to fix that.

Abigail

Replies are listed 'Best First'.
Re: Re: Sub call isn't returning values
by tinita (Parson) on Mar 03, 2004 at 09:22 UTC
    IMO, that's a very wrong thing to do. It won't teach you *anything*. If code works, or if you think it works just because it happens to produce the right output on a few test cases, it's just luck. It won't give you much insight.

    while i generally agree with that, i must say that it sometimes happens to me that i find myself trying out things until i get what i want. of course checking the docs before or after is crucial, but, to tell the truth, i learned a lot of cool perl features by trying out, just for the fun of it. (mostly that happened when playing golf or something, less often when i program production code)
    being curious and creative can help becoming a good programmer, IMHO.