# 実行してみて
for $num (1..3){
  $_ = '1' x ($num - 1);
  print /[0-9]{$num}/ ? 'ok,' : 'not ok,';
  $_ = '1' x $num;
  print /[0-9]{$num}/ ? 'ok,' : 'not ok,';
  $_ = '1' x ($num + 1);
  print /[0-9]{$num}/ ? 'ok,' : 'not ok,';
  print "\n";
}