in reply to HoHoH Insertion Order
Also, I suggest that you use strict;, as your original code had the following (lines three and four) which refer to different variables:use Tie::IxHash; use strict; my $HoHoH = {}; tie %{$HoHoH->{$_}}, 'Tie::IxHash' foreach qw(alice john andy); + # rest of code as above # output: alice aaaa time = 20:00:00 www time = 22:00:00 bbb time = 25:00:00 andy xxx time = 24:00:00 yyy time = 26:00:00 john ccc time = 21:00:00 aaa time = 23:00:00
strict will catch this at compile time:# global %HoHoH tie %{$HoHoH{text}}, 'Tie::IxHash'; # lexical $HoHoH (reference) my $HoHoH = {};
Your code ties a different variable than you were using everywhere else in your code. In addition, the key "text" that points to the inner hash stored in your global hash %HoHoH isn't used anywhere else.Global symbol "%HoHoH" requires explicit package name at /tmp/1.pl lin +e 4.
|
---|