1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/env perl use strict; use warnings; # Perl入学式 2018 第2回 復習問題 # https://github.com/perl-entrance-org/workshop-2018/blob/master/2nd/practice.md # 復習問題(sum.pl) # 1から100までの値を配列に格納し, その配列の全ての数値を足した結果を出力するsum.plを作成しよう my @number = ( 1 .. 100 ); my $sum = 0; for my $num (@number) { $sum += $num; } print $sum; # 5050
You can clone a snippet to your computer for local editing. Learn more.