in reply to Re: how to substiute given key with value by using hash.
in thread how to substiute given key with value by using hash.

Why not something like:

>perl -wMstrict -le "my %Variables = ( NAME => 'Roboticus', STATE => 'KY', BIRD => 'Cardinal', ); my $vkey = qr{ @{[ join '|', map quotemeta, keys %Variables ]} }xms; ;; my $Template = '{NAME} lives in {STATE}. {FOO}.'; ;; $Template =~ s{ {($vkey)} }{$Variables{$1}}xmsg; print qq{'$Template'}; " 'Roboticus lives in KY. {FOO}.'