On Fri, Nov 26, 2004 at 06:19:28PM -0800, Graeme St. Clair wrote: > my %sname = qw { > COUNTRY_NAME Country > ... > }; > my %words2 = ( > "ORDER_NUMBER", "Order Number", > ... > ); > #%sname{keys %words2} = values %words2; > %sname = (%sname, %words2); > > I couldn't find a way to combine the whole assignment into any fewer > statements, apart from the obvious way of double-quoting everything in > sight, on the model of %words2. Moreover, the commented line was lifted > straight out of the Llama book 2nd Ed p70, and gave a syntax error - the > line below it works, but is described there as "much slower" than the > commented line.
Either you have miscopied that line or there is an error in the Llama. @sname{keys %words2} = values %words2; > Any offers to improve the foregoing, other than what I've called "the > obvious way"? This, perhaps? use Data::Dumper; %s = ( qw( a 1 b 2 ), c => "3 3", d => "4 4", ); print Dumper \%s; %t = ( e => 5 ); @t{keys %s} = values %s; print Dumper \%t; -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>