#!./perl -w
BEGIN {
chdir 't' if -d 't';
}
# use strict;
# The peephole optimiser already knows that it should convert the string in
# $foo{string} into a shared hash key scalar. It might be worth making the
# tokeniser build the LHS of => as a shared hash key scalar too.
# And so there's the possiblility of it going wrong
# And going right on 8 bit but wrong on utf8 keys.
# And really we should also try utf8 literals in {} and => in utf8.t
# Some of these tests are (effectively) duplicated in each.t
# defeat any tokeniser or optimiser cunning
my $key = 'ey';
# now with cunning:
#tokeniser may treat => differently.
# now with cunning:
# defeat any tokeniser or optimiser cunning
$key = 'ey';
# now with cunning:
#tokeniser may treat => differently.
# now with cunning:
my %slow;
my (%names, %names_copy);
'%', 'Hash', '&', 'Code');
%names_copy = %names;
my %args = @_;
}
my $self = shift;
my %args = @_;
}
return %names;
}
my $self = shift;
return %names;
}
my %args = @_;
return %args;
}
my $self = shift;
my %args = @_;
return %args;
}
my %names_copy2 = %names;
# This should get ignored.
# This should not
'*', 'Typeglob',);
# And now UTF8
# This little game may set a UTF8 flag internally. Or it may not. :-)
# defeat any tokeniser or optimiser cunning
# defeat any tokeniser or optimiser cunning
}
# now some tests for hash assignment in scalar and list context with
# duplicate keys [perl #24380]
{
my %h; my $x; my $ar;
'hash assignment in list context removes duplicates' );
'hash assignment in scalar context' );
'scalar + hash assignment in scalar context' );
}