|There's more than one way to do things|
undefined elements in arrayby Ntav (Sexton)
|on Sep 09, 2001 at 15:43 UTC||Need Help??|
Ntav has asked for the
wisdom of the Perl Monks concerning the following question:
problem: I'm adding elements to an array according to positions defined in a lookup table, so when it comes time to print the array some elements are undefined.(this is the correct behaviour - not to be "fixed")
current solution: when printing, I test:
and though this works (i.e. when I print I don't try and print an uninitialized variable) if I execute with warnings on, perl complains.
question: So, learned monks, what is the smart solution?
Not Another Perl Hacker
In fact I'm more used to declarative programming so the above code looks rather odd to me!