[問題] 問一下哪裡語法錯誤?

看板Perl作者 (gigantic30)時間16年前 (2008/10/08 00:04), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/2 (看更多)
這是我第一次寫perl, 請板上高手指點一下 謝謝^^ %h=(fib(0)=>1, fib(1)=>1); sun fib { $h{fib($_[0])} = fib($_[0]-1)+fib($_[0]-2); return $h{fib($_[0])}; } print "Enter an integer>=0: "; $n=<stdin>; $ans=fib($n); print "The $nth Fibonacci number is $ans"; print "\nBelow is the hash table created during the computation.\n" foreach (keys %h){ print "$_=>$h{$_}\n"; } -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.196.69

10/08 10:29, , 1F
這是交大這學期 PL 作業? XD
10/08 10:29, 1F
文章代碼(AID): #18wuYYxo (Perl)
討論串 (同標題文章)
文章代碼(AID): #18wuYYxo (Perl)