in reply to Re: creating multiple views of a hash by reordering its key and values
in thread creating multiple views of a hash by reordering its key and values
They will? I tried the following:
which outputs:#!/usr/bin/perl -w use strict; my %hash; $hash{foo}{bar}{x} = 'zoom!'; $hash{bar}{foo}{x} = $hash{foo}{bar}{x}; print "$hash{foo}{bar}{x}\n"; print "$hash{bar}{foo}{x}\n"; $hash{foo}{bar}{x} = '!mooz'; print "$hash{foo}{bar}{x}\n"; print "$hash{bar}{foo}{x}\n";
Now, if maybe I'm misunderstanding what your code does, but while it gives two separate views of the data, it does not create a duplicate set of references to a single set of data... if my calculations are correct it creates a second copy of the data with new references to the second copy. Changes to one copy will not affect the other.zoom! zoom! !mooz zoom!
|
|---|