in reply to regex question
[ Ignore this post, I missed how you just want a list of the numbers at the end ]
my %value_lkup = ( A => '1000', B => '2000', ); my $pat = '[' . join('', keys %value_lkup) . ']'; s/($pat)/$value_lkup{$1}/g;
or
s/([AB])/ ( ord($1)-ord('A')+1 )*1000 /eg;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex question
by markkawika (Monk) on Sep 02, 2009 at 23:34 UTC | |
by ikegami (Patriarch) on Sep 03, 2009 at 00:00 UTC |