in reply to Re^8: Best complex structure?
in thread Best complex structure?
In my case, I found this solution, because $structure is not declared.
Ah! That means you do not have strict and warnings enabled in your code?
Whilst it is fine to ask naive questions (at least once and maybe even twice :), not using strict and warnings is unacceptable when you are asking for help.
Why? Because each time you find a problem, and post code asking for help, the first thing I (and most others) are going to do is add strict and warnings and run perl -c yourscript in order to let the compiler tell us what errors you are making. Then we would have to post a reply pointing these problem out to you.
Why should we do this, when the compiler can tell you about your mistakes directly?
The compiler may seem pedantic and complain about a lot of things that you seem to be able to get away with by ignoring them, but each of those warnings is there for a very good reason: That of helping you write better code.
If you choose to not use strict and warnings, you are effectively saying that you know better than the compiler. In which case, you don't need my help, because I always let the compiler point out my errors.
This code
push @structure , []; for (my $i=0;$i<= $#ex; $i++) { push @{ @structure->[$j]}, $ex[$i]; }
Produces a warning. But more importantly, demonstrates that you are misunderstanding something quite important. Enabling warnings and working out how to stop that warning being produced will force you to become aware of that misunderstanding. It is much better that you do this now, before you misunderstanding becomes a long term habit that will continue to bite you each time you make it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Best complex structure?
by mat21 (Beadle) on Jun 10, 2005 at 13:04 UTC | |
by BrowserUk (Patriarch) on Jun 10, 2005 at 14:08 UTC |