in reply to Re^2: problem with substitute in regexp
in thread problem with substitute in regexp
#! /usr/bin/perl -w use strict; my %replace = ('111'=>"bar", '222'=>"world", '333'=>"perl"); my $str = "f111,f222,f333"; $str =~ s/f([0-9]+)/$replace{$1}/g; print "$str\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: problem with substitute in regexp
by roboticus (Chancellor) on Nov 10, 2011 at 15:53 UTC |