On Mon, Dec 21, 2009 at 9:11 AM, jbl <jbl...@gmail.com> wrote: > The desired output would be > 91416722 243rd St > > I am getting this as output > > 91416722rd St <- just the rd St > > <snip>
> while ( defined ( my $line = <DATA> ) ) { > $line =~ s/(\s)243 /$1243rd /g; > print MY_OUTPUT_FILE $line; > } > Try this: $line =~ s/(\s)243 /${1}243rd /g; Without the braces, Perl is looking for match number 1,243! Braces separate the 1 from the 243. -- Robert Wohlfarth