On 15 Oct 2007 at 14:19, Kevin Viel wrote: > I have to change the a CSV file, which represents numeric missing data > with a period (.). For instance: > > One,.,.,. > > Should be: > > One,,, > > I have written: > > > $_ =~ s/,\.,/,,/g ; > > > However, I have a requirement to substitute overlapping data. Do I > need to write a loop conditional on a match of /,\.,/ or is there > something I missed?
You need to use a zero width positive lookahead (see perldoc perlre) and you have to check for , or end of string: $s = 'One,.,.,.'; $s =~ s/,\.(?=,|$)/,/g; print $s; HTH, Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/