in reply to Re^2: get one value from Tie::IxHash
in thread get one value from Tie::IxHash
Values takes indices, indices are integers, int 'a' and int 'b' are both 0, and first key added is 'a' whose value is 9
#!/usr/bin/perl -- use strict; use warnings; use Tie::IxHash; #~ adapted from #~ http://cpansearch.perl.org/src/GSAR/Tie-IxHash-1.21/t/ixhash.t my $TNUM = 0; sub T { my($in,$out)=@_; print "# is \n# $in\n# $out\n"; print $in eq $out ? "ok " : "not ok ", ++$TNUM, "\n" } my $ixh = tie (my(%bar), 'Tie::IxHash', 'a' => 1, 'q' => 2, 'm' => 'X' +, 'n' => 'Y'); #$ixh = Tie::IxHash->new('a' => 1, 'q' => 2, 'm' => 'X', n => 'Y'); $ixh->Push(e => 5, f => 6); T 'a|1|q|2|m|X|n|Y|e|5|f|6' , join('|', %bar); $ixh->Delete('e', 'a'); T 'q|2|m|X|n|Y|f|6' , join '|', %bar; T 'q|m|n|f' , join '|', $ixh->Keys; T '2|X|Y|6' , join '|', $ixh->Values; T 'm|n|f' , join '|', $ixh->Keys(1, 2, 3); T 'X|Y|6' , join '|', $ixh->Values(1, 2, 3);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |