#!/usr/bin/perl -w use strict; use Tie::IxHash; my %hash = %{ &fooFunc(); }; print "Compare this order to insertion order of fooFunc:\n\n"; foreach (keys %hash) { print $hash{$_}."\n"; } print "\n"; sub fooFunc { tie my %h, "Tie::IxHash"; $h{'donald'} = 'duck'; $h{'calvin'} = 'human'; $h{'hobbes'} = 'tiger'; $h{'mickey'} = 'mouse'; $h{'zorak'} = 'bug'; return \%h; }