I want to have a perl subroutine that creates and returns an ordered hash via the Tie::IxHash module. It looks something like this:
sub make_ordered_hash {
my @hash_contents = munge_input(@_); # I get a list of alternating keys and values
tie(my %myhash, Tie::IxHash, @hash_contents);
return %myhash;
}
Now, if I do my %ordered_hash = make_ordered_hash(@input_stuff)
, will %ordered_hash actually be tied, or will it unpack %myhash, into a list and then create a new (ordinary, unordered) hash from that list? If I can't return a tied hash in this way, can I return a reference to one? That is, can I fix it by having make_ordered_hash return \%myhash
instead?