1999-02-01 配列の各要素に先頭から順に 1,2,3,4,5 を代入して表示 (for文) Perl 明解C言語 入門編 > 5. 配列 > 配列の各要素に先頭から順に 1,2,3,4,5 を代入して表示 (for文) Perl for (0..4) { $score[$_] = $_ + 1; } for (0..4) { printf("点数%d = %d\n", $_ + 1, $score[$_]); } 実行結果 L:\>perl lesson_05_031.pl 点数1 = 1 点数2 = 2 点数3 = 3 点数4 = 4 点数5 = 5