Help for this page

Select Code to Download


  1. or download this
     # Capture the first five words including whitespace.
     ($text) = $text =~ / (\S+ \s+
    ...
                           \S+ )/x;
     # Shrink any internal whitespace
     $text =~ s/\s+/ /g;
    
  2. or download this
     # Capture the first five words including whitespace.
     if ( $text =~ / (\S+ \s+
    ...
         # Shrink any internal whitespace
         $text =~ s/\s+/ /g;
     }
    
  3. or download this
     if ( $text =~ s/ (\S+ \s+
                       \S+ \s+
    ...
         # The match succeeded, shrink the white space
         $text =~ s/\s+/ /g;
     }