On Tuesday, January 7, 2003, at 10:31 AM, Peter Scott wrote:
I replaced the entirety of sub displayResults with:[EMAIL PROTECTED] (Christopher D . Lewis) writes:My problem is that the errors Perl coughs up end with:syntax error at ./nudice-01c line 187, near "sub displayResults " syntax error at ./nudice-01c line 305, near "sub rollRequest" syntax error at ./nudice-01c line 325, near "while @rawRollArray" syntax error at ./nudice-01c line 457, near "}" Execution of ./nudice-01c aborted due to compilation errors. This would be all well and good, except that every text editor I point at my program agrees that the actual line count ends at 304. Ideas?What line numbers do your text editors say the above statements are actually on? Sprinkle a few print __LINE__; statements around and see what Perl thinks the line numbers are.
sub displayResults { print __line__ . "sub displayResults"; }
(both to get Perl's idea of the line numbers, and to implement another suggestion I replace contents of problem subroutines with simple code to track down bugs)
and my errors went from:
chris% ./nudice-01c
"my" variable $labelThrow masks earlier declaration in same scope at ./nudice-01c line 193.
"my" variable @requests masks earlier declaration in same statement at ./nudice-01c line 193.
"my" variable $requestNumber masks earlier declaration in same statement at ./nudice-01c line 193.
"my" variable $labelThrow masks earlier declaration in same scope at ./nudice-01c line 195.
"my" variable @requests masks earlier declaration in same scope at ./nudice-01c line 195.
"my" variable $requestNumber masks earlier declaration in same scope at ./nudice-01c line 195.
"my" variable $labelThrow masks earlier declaration in same scope at ./nudice-01c line 197.
"my" variable @requests masks earlier declaration in same scope at ./nudice-01c line 197.
"my" variable $requestNumber masks earlier declaration in same scope at ./nudice-01c line 197.
"my" variable @requests masks earlier declaration in same statement at ./nudice-01c line 197.
"my" variable $requestNumber masks earlier declaration in same statement at ./nudice-01c line 197.
syntax error at ./nudice-01c line 187, near "sub displayResults "
syntax error at ./nudice-01c line 305, near "sub rollRequest"
syntax error at ./nudice-01c line 325, near "while @rawRollArray"
syntax error at ./nudice-01c line 457, near "}"
Execution of ./nudice-01c aborted due to compilation errors.
to the more modest:
chris% ./nudice-01c
syntax error at ./nudice-01c line 187, near "sub displayResults "
syntax error at ./nudice-01c line 189, near "sub rollRequest"
syntax error at ./nudice-01c line 209, near "while @rawRollArray"
syntax error at ./nudice-01c line 341, near "}"
Execution of ./nudice-01c aborted due to compilation errors.
So, now that I know all the variable problems are in displayResults despite the line numbers being off, I can start looking outside displayResults for the other errors. I note in passing that I can't find a bunch of "my labelThrow" masking one another, as in displayResults I make the label for each throw using:
my $labelThrow; # Identifies throw type for table readers
# Calculates Label for "Throw"
$labelThrow .= $requests[$requestNumber]{"numDicePerThrow"} if $requests[$requestNumber]{"numDicePerThrow"} > 1; # Puts numDice in throw's label if > 1
$labelThrow .= "d" . $requests[$requestNumber]{"numSidesPerDie"}; # Puts Die size
$labelThrow .= $requests[$requestNumber]{numAddedToThrow} if $requests[$requestNumber]{numAddedToThrow};#Puts numAddedToThrow in throw's labal if nonzero
Does anyone spot what I'm doing wrong in trying to build a this label's contents in this way?
Note that I have no idea at all what I'm doing with these data structures, what's why it is "practice" :-)
Many thanks,
Chris
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]