各位 Perl 高手,下面是一个子程序:
34 sbu fibonacci {
35 my $target = shift;
36 my ($a, $b) = (1, 0);
37 for (my $i = 1; $i <=$target; $i++) {
38 my $c = $a + $b;
39 print "fibonacci($i) => $c\n";
40 ($a, $b) = ($b, $c);
41 }
42 }
当我执行这个程序时,Perl 显示如下出错信息:
syntax error at ./facfib.pl line 36, near "my "
syntax error at ./facfib.pl line 42, near "}"
Execution of ./facfib.pl aborted due to compilation errors.
谁能告诉我36行,42行有什么错误?
34 sbu fibonacci {
35 my $target = shift;
36 my ($a, $b) = (1, 0);
37 for (my $i = 1; $i <=$target; $i++) {
38 my $c = $a + $b;
39 print "fibonacci($i) => $c\n";
40 ($a, $b) = ($b, $c);
41 }
42 }
当我执行这个程序时,Perl 显示如下出错信息:
syntax error at ./facfib.pl line 36, near "my "
syntax error at ./facfib.pl line 42, near "}"
Execution of ./facfib.pl aborted due to compilation errors.
谁能告诉我36行,42行有什么错误?