Help for this page

Select Code to Download


  1. or download this
    $string =~ s/\s+/ /g;
    
  2. or download this
    # replace all multiple whitespace characters from $string
    # \s represents a whitespace character (space, tab, newline etc)
    # + means 'one or more'
    $string =~ s/\s+/ /g;