Thread View: fj.lang.perl
4 messages
4 total messages
Started by Nobukatsu Yakushiji
Thu, 09 Apr 1998 00:00
$B4X?t$N:F5/8F$S=P$7(J
Author: Nobukatsu Yakushiji
Date: Thu, 09 Apr 1998 00:00
Date: Thu, 09 Apr 1998 00:00
6 lines
475 bytes
475 bytes
$B;O$a$^$7$F!#(J
Perl $B$G$O4X?t$N:F5"8F$S=P$7$O$G$-$J$$$N$G$7$g$&$+!)(J
$BLt;U;{(J $B?.>!(J
Re: 関数の再起呼び出し
Author: Shugo Maeda
Date: Fri, 10 Apr 1998 00:00
Date: Fri, 10 Apr 1998 00:00
25 lines
1150 bytes
1150 bytes
前田です。
"Nobukatsu Yakushiji" <nyakushi@fsinet.or.jp> wrote:
|Perl では関数の再帰呼び出しはできないのでしょうか?
Perlはあまり知らないのですが、
sub fact {
local($n) = @_;
if ($n < 2) {
return 1;
}
else {
return $n * &fact($n - 1);
}
}
print &fact(shift(@ARGV)), "\n";
のように再帰できると思うのですが...。
--
前田 修吾
Re: $B4X?t$N:F5/8F$S=P$7(J
Author: Nobukatsu Yakushiji
Date: Fri, 10 Apr 1998 00:00
Date: Fri, 10 Apr 1998 00:00
20 lines
928 bytes
928 bytes
$B<+8J%l%9$G$9!#(J
$B:F5"8F$S=P$7$O$G$-$^$7$?!#(J
Perl $BFb$G@k8@$7$?JQ?t$,<+F0E*$K%0%m!<%P%kJQ?t$K$J$k$H$$$&$3$H$r(J
$BK:$l$F$*$j$^$7$?!#(J
$B4X?tFb$G;H$&JQ?t$O!"%m!<%+%kJQ?t$H$7$F@k8@$7$F;HMQ$7$?$i!"(J
$B:F5"E*$J=hM}$r$&$^$/Av$i$;$k$3$H$,$G$-$^$7$?!#(J
Nobukatsu Yakushiji <nyakushi@fsinet.or.jp> wrote in article
<01bd63ab$f0c56e30$1400a8c0@yaku>...
> $B;O$a$^$7$F!#(J
>
> Perl $B$G$O4X?t$N:F5"8F$S=P$7$O$G$-$J$$$N$G$7$g$&$+!)(J
>
> $BLt;U;{(J $B?.>!(J
>
>
>
Re: 関数の再起呼び出し
Author: Maki Watanabe
Date: Sat, 11 Apr 1998 00:00
Date: Sat, 11 Apr 1998 00:00
5 lines
676 bytes
676 bytes
Perl5でしたら、localよりも my を使う習慣をつけたほうが いいでしょう。 mw
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads