in reply to variable inside hash key

I think I prefer toolic's computation of  $key as a separate step (more readable/maintainable), but if you really need it all in one statement:

c:\@Work\Perl>perl -wMstrict -le "my $v = { R3R3_foo_IF => 'xyzzy', R3R3_bar_IF => 'wibble', }; ;; my $pic = 'foo'; ;; print qq{whatever $v->{ qq{R3R3_${pic}_IF} } and so on}; " whatever xyzzy and so on
(Note that I use  qq{...} instead of  "..." only to avoid distracting  \ escapes on the Windows command line.)

Update: The trick is to realize that  $v->{ qq{R3R3_${pic}_IF} } is really  $v->{ EXPR } where EXPR is any expression whatsoever (but not a statement). So  $v->{ qq{R3R3_${pic}_IF} } evaluates to a scalar which is double-quote-ishly interpolated as usual.


Give a man a fish:  <%-{-{-{-<