「Perl」配列を使うサンプル
構文
@配列名 = (値1,値2);
サンプルコード
#!/usr/bin/perl @cft= (39, 49, 59); @names = ("A001", "B002", "C003"); print "\$hits[0] = $hits[0]\n"; print "\$hits[1] = $hits[1]\n"; print "\$hits[2] = $hits[2]\n"; print "\$names[0] = $names[0]\n"; print "\$names[1] = $names[1]\n"; print "\$names[2] = $names[2]\n";
実行結果
$hits[0] = 39
$hits[1] = 49
$hits[2] = 59
$names[0] = A001
$names[1] = B002
$names[2] = C003