Bakken, Luke wrote: > > > Here are two solutions I found: > > > > > > $rec->{"loans:a_$fld" . "[$i]"} = $tmp{$fld} || ''; > > > $rec->{"loans:a_$fld\[$i]"} = $tmp{$fld} || ''; > > > > > > Are there any other ways? Just curious. > > > > "loans:a_${fld}[$i]" also works. I like your second version above > > best. > > > > $ perl -MO=Deparse,-q -e '"a_${fld}[$i]"' > > 'a_' . $fld . '[' . $i . ']'; > > > > $ perl -MO=Deparse,-q -e '"a_$fld\[$i]"' > > 'a_' . $fld . '[' . $i . ']'; > > Hmm you know that was the first thing I tried, but I always get this > error, indicating it's still looking for @fld: > > I also have use strict on. > > C:\tmp>perl testadr > Global symbol "@fld" requires explicit package name at testadr line > 37. Global symbol "@fld" requires explicit package name at testadr > line 43. BEGIN not safe after errors--compilation aborted at testadr > line 48.
You're right. I guess what I wrote is a no-no. Writing something like "${fld}foo" is like $fld . "foo" But the opening square bracket seems to cause problems with strict turned on. Maybe somebody smarter than me (shouldn't be hard to find!) can explain further. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]