|Perl: the Markov chain saw|
Re^3: Problem printing return value from a subroutineby AnomalousMonk (Abbot)
|on Oct 04, 2012 at 11:15 UTC||Need Help??|
I must admit I haven't the foggiest notion what your code is trying to accomplish. However, I have never felt that mere ignorance should deter one from offering advice, so...
The quoted subroutine has two odd, nested for-loops. The outer loop
uses the expression \@z to create a single item loop list consisting of a reference to the @z array. The loop will iterate once over this single reference, aliasing (or 'topicalizing', which I believe is the more apt term) its value to the $QT scalar. The $QT reference is used a couple of times, in each case being de-referenced to an array prior to use. So, what's the point? Why not just use the @z array directly and forget about all the indirection and one-pass looping?
The inner for-loop
iterates over the global, spooky-action-at-a-distance-prone @trip array, which seems as if it may have multiple elements. However, since the statement body of the loop ends with the
So we end up with something like (again, I have no idea what this is supposed to do):
Minimizing the cruft and wasted motion may allow you to see more clearly the root causes of your problems. Anyway, that's my USD0.02. I hope it helps.