in reply to problem with substitute in regexp
outputmy %replace = ('111'=>bar, '222'=>world, '333'=>perl); my $find = join "|", sort keys %replace; my $str = "f111,f222,f333"; $str =~ s/f([0-9]+)/$replace{$1}/g; print "$str\n";
bar,world,perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: problem with substitute in regexp
by roboticus (Chancellor) on Nov 10, 2011 at 11:37 UTC | |
by ansh batra (Friar) on Nov 10, 2011 at 15:38 UTC | |
by roboticus (Chancellor) on Nov 10, 2011 at 15:53 UTC | |
|
Re^2: problem with substitute in regexp
by bluray (Sexton) on Nov 11, 2011 at 16:36 UTC |