This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add test for grep() and wantarray
authorHugo van der Sanden <hv@iii.co.uk>
Tue, 18 Feb 1997 11:05:59 +0000 (11:05 +0000)
committerChip Salzenberg <chip@atlantic.net>
Fri, 21 Feb 1997 16:41:00 +0000 (04:41 +1200)
commitd53f8f1cc3de155a009198bbc7c01e2741aa70ac
treea09288f7c5dbb6716d7b5dba1c049d9595087541
parentea368a7c10bc6e18dd8f876577b54cc646eff77e
Add test for grep() and wantarray

Subject: Re: subscript when wantarray

In <199702172207.RAA20755@rio.atlantic.net>, Chip Salzenberg writes:
:First, here's a patch that makes the first case print "2"
[...]
:Second, the reason that it prints "2" instead of "3" is that
:C<(undef)[0]> evaluates to the empty list in an array context,
:but to C<undef> in a scalar context.  This is on purpose.
Yep, I expected that.

Patch worked fine here; below is an extra test using the same code as my
original example.

p5p-msgid: <199702181105.LAA17895@tyree.iii.co.uk>
t/op/misc.t