#!./perl
#
# grep() and map() tests
#
print "1..38\n";
$test = 1;
}
{
$test++;
$test++;
$test++;
}
{
$test++;
print map
$test++;
$test++;
({a=>$_},
$test++;
$test++;
print map
$test++;
$test++;
{a=>$_},
$test++;
my $x = "ok \xFF\xFF\n";
$test++;
print map
$test++;
$test++;
print map
$test++;
$test++;
print grep
$test++;
$test++;
print grep
({a => $_}->{a},
$test++;
$test++;
print grep
$test++;
$test++;
print grep
{a => $_}->{a},
$test++;
$test++;
print grep
$test++;
$test++;
print grep
$test++;
}
# Tests for "for" in "map" and "grep"
# Used to dump core, bug [perl #17771]
{
my @x;
my $y = '';
@x = map { $y .= $_ for 1..2; 1 } 3..4;
print "# @x,$y\n";
$test++;
$y = '';
@x = map { $y .= $_ for 1..2; $y .= $_ } 3..4;
print "# @x,$y\n";
$test++;
$y = '';
print "# @x,$y\n";
$test++;
$y = '';
@x = grep { $y .= $_ for 1..2; 1 } 3..4;
print "# @x,$y\n";
$test++;
$y = '';
print "# @x,$y\n";
$test++;
# Add also a sample test from [perl #18153]. (The same bug).
$test++;
}
{
};
$test++;
}
{
my $gimme;
sub gimme {
} else {
}
}
my @list = 0..9;
}
{
# This shouldn't loop indefinitively.
}