Perl includes a special escape that stands for any whitespace character, which is "\s". Thus, you can simplify your regex by using:
$cuname =~ s/\s+/ /; #replace one or more whitespace chars with a space What I have done is used the s/// (substitution) operator to substitute one space for one or more whitespace characters. Also, let's take a quick look at your regular expression, because there are a few errors. $newcuname = /" "+/" "/$cuname; First off, the '=' there should be '=~'. This is the operator you use for matches, transliteration, and substitution. Second, you have double-quotes in the regex that you don't need. You shouldn't use double-quotes in a regex as string barriers. Again, check out 'perldoc perlre' for more info. -----Original Message----- From: Ned Cunningham To: '[EMAIL PROTECTED]' Sent: 5/17/02 9:15 AM Subject: Regex a name field Can anyone give me a hand please? I have a file James T Nobel James T. Nobel, Jr. James and Kathy Nobel James T Nobel James T Nobel I am trying to replace the spaces with a single space My code so snippet is: $cuname = $data[53]; $newcuname = /" "+/" "/$cuname; But it isnt working TIA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]