CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [kencl] Nicer way to do this?: Edit Log



KevinR
Veteran


Oct 9, 2003, 8:56 PM


Views: 7213
Re: [kencl] Nicer way to do this?

another way to accomplish the same thing:


Code
my $list = 'one|two|three|four'; 
my %changes = (one => 1, three => 3);

foreach (keys %changes) {
$list =~ s/$_/$changes{$_}/g;
}
print $list;

-------------------------------------------------


(This post was edited by KevinR on Oct 9, 2003, 8:57 PM)


Edit Log:
Post edited by KevinR (Veteran) on Oct 9, 2003, 8:57 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives