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