Help for this page

Select Code to Download


  1. or download this
    $string = "now is the time for all good men to come to the aid of thei
    +r country while the gratuitously extralongwordwithmorethantwentychara
    +ctersexdtendson and on.";
    
    grep { push(@arr,substr($_,0,19)) } split (" ",$string);
    
    print join("\n",@arr);
    
  2. or download this
    
    while ( $string =~ /(\S.{0,19})(?=\s|$)/g ) {  
    ...
    for my $arr(@arr) {
            print $arr . "\n";
    }