文字(文字列)を指定回数繰り返す
Perl では驚くほど簡単に特定の文字(文字列)の繰り返しを作成する事が出来ます。 下記のサンプルを見てください。
$recommendation = "Sample\n" x 10; print $recommendation;
上記サンプルは、文字列 "Sample\n" を 10個連結した結果を 変数 $recommendation へ代入すると言う意味です。結果は以下のようになります。
Sample Sample Sample Sample Sample Sample Sample Sample Sample Sample
|