Date: Sun, 23 Sep 2001 13:46:13 GMT From: Bart Lateur Subject: Re: extra newline in s command Message-Id: <0oprqtsnpiv3tjj3huifm23a21jfuc3bgi@4ax.com> laura fairhead wrote: >Can anyone explain to me why I'm getting extra >newlines inserted with the s/// command in this >script; > >open(FILE,qq[patternfile]) >@k=(qq[0000],) >while(<>){ > /(\d{4})/&& $1<=$#k && s/$1/$k[$1]/ ; > print > } > > >Every line that has an s/// done on it has >an extra newline and I don't see why it's >doing that. Beause your substitution array items all contain newlines. You just read them from a file, and you didn't chomp() them. -- Bart.