#!./perl
BEGIN {
chdir 't' if -d 't';
}
$h{'abc'} = 'ABC';
$h{'def'} = 'DEF';
$h{'jkl','mno'} = "JKL\034MNO";
$h{'a'} = 'A';
$h{'b'} = 'B';
$h{'c'} = 'C';
$h{'d'} = 'D';
$h{'e'} = 'E';
$h{'f'} = 'F';
$h{'g'} = 'G';
$h{'h'} = 'H';
$h{'i'} = 'I';
$h{'j'} = 'J';
$h{'k'} = 'K';
$h{'l'} = 'L';
$h{'m'} = 'M';
$h{'n'} = 'N';
$h{'o'} = 'O';
$h{'p'} = 'P';
$h{'q'} = 'Q';
$h{'r'} = 'R';
$h{'s'} = 'S';
$h{'t'} = 'T';
$h{'u'} = 'U';
$h{'v'} = 'V';
$h{'w'} = 'W';
$h{'x'} = 'X';
$h{'y'} = 'Y';
$h{'z'} = 'Z';
$i = 0; # stop -w complaints
}
}
keys %h = 1;
%h = (1,1);
undef %h;
%h = (1,1);
# test scalar each
%hash = 1..20;
$total = 0;
keys %hash;
$total = 0;
$total = 0;
values %hash;
$total = 0;
$i = 0;
$i++;
}
}
{
{
my $h = { A => bless [], __PACKAGE__ };
}
}
print "ok $::tests[2]\n";
}
# Check for Unicode hash keys.
%u = ("\x{12}", "f", "\x{123}", "fo", "\x{1234}", "foo");
$u{"\x{12345}"} = "bar";
@u{"\x{10FFFD}"} = "zap";
my %u2;
$u2{$_} = $u{$_};
}
$a = "\xe3\x81\x82"; $A = "\x{3042}";
%b = ( $a => "non-utf8");
%u = ( $A => "utf8");
# on EBCDIC chars are mapped differently so pick something that needs encoding
# there too.
%u = ($d => "downgrade");
}
{
}
{
my %u;
$u{$u0} = 1;
$u{$b0} = 2;
$u{$u1} = 3;
$u{$b1} = 4;
}