Now, you can't just blind assign one to the other, since one is a ref and the other is a real hash, and the names differ slightly. Also, there is stuff on both sides that isn't meant to be touched. Isn't there a better way to specify the mapping?$big_foo_bucket->{camshaft} = $other_foo_bucket{camshaft}; $big_foo_bucket->{gearbox} = $other_foo_bucket{gearbox1}; $big_foo_bucket->{drivetrain} = $other_foo_bucket{the_drivetrain}; $big_foo_bucket->{smokestack} = $other_foo_bucket{my_smokestack}; $big_foo_bucket->{junkyard} = $other_foo_bucket{_junkyard};
Yet the results from a structural and scalability perspective aren't entirely satisfactory. The two lists that must be maintained in parallel or Bad Things happen. Further, when you start to add many things to the list, it's either going to scroll or wrap, both of which lead this to be a self-defeating solution.@{$big_foo_bucket}{qw[ camshaft gearbox drivetrain smokestack junkyard ]} = @other_foo_bucket{qw[ camshaft gearbox1 the_drivetrain my_smokestack _junkyard ]};
Now this works, but seems highly unorthodox, which would probably mean that it's some Dark form of Laziness that you're supposed to keep to yourself.schlep(\%other_foo_bucket => $big_foo_bucket, qw[ camshaft camshaft gearbox1 gearbox the_drivetrain drivetrain my_smokestack smokestack _junkyard junkyard ]);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bulk Hash Assignment
by particle (Vicar) on Apr 17, 2002 at 12:33 UTC | |
by tadman (Prior) on Apr 17, 2002 at 20:40 UTC | |
by particle (Vicar) on Apr 17, 2002 at 21:12 UTC | |
by tadman (Prior) on Apr 17, 2002 at 22:20 UTC | |
by pdcawley (Hermit) on Apr 19, 2002 at 07:31 UTC | |
|
Re: Bulk Hash Assignment
by Fletch (Bishop) on Apr 17, 2002 at 12:55 UTC | |
by tadman (Prior) on Apr 17, 2002 at 20:38 UTC | |
|
(MeowChow) Re: Bulk Hash Assignment
by MeowChow (Vicar) on Apr 17, 2002 at 11:43 UTC | |
|
Re: Bulk Hash Assignment
by Molt (Chaplain) on Apr 17, 2002 at 09:33 UTC | |
|
Re: Bulk Hash Assignment
by seattlejohn (Deacon) on Apr 17, 2002 at 15:19 UTC | |
|
Re: Bulk Hash Assignment
by premchai21 (Curate) on Apr 17, 2002 at 17:07 UTC |