Help for this page

Select Code to Download


  1. or download this
    @numbers = (4, 5, 6);   # not necessarly consecutive
    $str = 'test number X';
    ...
    $fmt=~s/X/\%d/;
    my @newArray=map {sprintf $fmt,$_} @numbers;
    print join "\n",@newArray;
    
  2. or download this
    @numbers = (4, 5, 6);   # not necessarly consecutive
    $str = 'test number X';
    ...
    $fmt=~s/X//;
    my @newArray=map { "$fmt$_" } @numbers;
    print join "\n",@newArray;