「Perl」for文で配列の値を取得するサンプル
構文
foreach my $変数名 (@配列名){
some code
}
使用例
#! /usr/bin/perl
use strict;
use warnings;
my @cft = ("A01","B02","C03","D04");
for(my $i=0; $i<=$#cft;$i++){
print $cft[$i];
}
foreach my $tt (@cft){
print $tt;
}
実行結果
A01B02C03D04
A01B02C03D04