in reply to regexp help -- word boundaries
Thankfully for you, there's an easy way to specify this: \b
Incidently, use of $a and $b is not recommended, since these are used in sorts.my $x = 'a'; my $y = 'b'; while (<DATA>) { chomp; s/\b$x\b/$y/g; print "$_\n"; } __DATA__ a a a a
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regexp help -- word boundaries
by japhy (Canon) on Jul 11, 2005 at 12:07 UTC |