Hi,
I'm trying to write a simple Hanoi tower program. Here is
the procedure I've wrote (with line numbers):
# hanoj (src,hlp,tgt,num)
# src,tgt,hlp,n-1 src,hlp,tgt,1 hlp,src,tgt,n-1
3: sub hanoj
4: {
5: if ($_[3] <= 1)
6: {
7: print "From $_[0] we put on $_[2] with the help of $_
[1]";
8: }
9: else
10: {
11: hanoj $_[0] $_[2] $_[1] ($_[3] - 1); print "From $_
[0] we put on $_[1] with the help of $_[2]";
12: hanoj $_[0] $_[1] $_[2] 1; print "From $_
[0] we put on $_[2] with the help of $_[2]";
13: hanoj $_[1] $_[0] $_[2] ($_[3] - 1); print "From $_
[1] we put on $_[2] with the help of $_[0]";
14: }
15: }
16:
17: hanoj 1 2 3 10
----------------
The procedure is ok as far as I know, since I copied it
from a Modula-2 program I wrote.
And when I start the program, I get the following error
messages. What is the problem?
Waiting for reply, Csaba
Scalar found where operator expected at ./hanoj.pl line 11,
at end of line
(Missing operator before ?)
syntax error at ./hanoj.pl line 11, near "] $_"
Scalar found where operator expected at ./hanoj.pl line 11,
at end of line
(Missing operator before ?)
Scalar found where operator expected at ./hanoj.pl line 12,
at end of line
(Missing operator before ?)
syntax error at ./hanoj.pl line 12, near "] $_"
Scalar found where operator expected at ./hanoj.pl line 12,
at end of line
(Missing operator before ?)
Number found where operator expected at ./hanoj.pl line 12,
near "] 1"
(Missing operator before 1?)
Scalar found where operator expected at ./hanoj.pl line 13,
at end of line
(Missing operator before ?)
syntax error at ./hanoj.pl line 13, near "] $_"
Scalar found where operator expected at ./hanoj.pl line 13,
at end of line
(Missing operator before ?)
Number found where operator expected at ./hanoj.pl line 26,
near "1 2"
(Missing operator before 2?)
syntax error at ./hanoj.pl line 26, near "1 2"
Number found where operator expected at ./hanoj.pl line 26,
near "2 3"
(Missing operator before 3?)
Scalar found where operator expected at ./hanoj.pl line 26,
at end of line
(Missing operator before ?)
Execution of ./hanoj.pl aborted due to compilation errors.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]