Closed p5pRT closed 21 years ago
There's a discussing in comp.lang.perl.misc which boils down to:
print \(1 .. 3);
gives
ARRAY(0x8175fe8)
which is quite surprising. One would have expected
SCALAR(0x8175fa0)SCALAR(0x8175fac)SCALAR(0x8175fb8)
which is what
print \(1\, 2\, 3);
gives.
This might be related to bug #8932.
On Wed\, Mar 19\, 2003 at 10:09:52PM -0000\, abigail@abigail.nl (via RT) wrote:
print \\\(1 \.\. 3\);
gives
ARRAY\(0x8175fe8\)
I think (that's my humble opinion) that the fact that print \(1..3) and my $i=3; print \(1..$i) produce different things is a bug.
However\, the code that takes care that Perl work like that seems to be very deliberate - and very old.
pp_hot.c:695 if (PL_op->op_flags & OPf_REF) { SETs((SV*)av); RETURN; } else if (LVRET) {
I failed to see other case that this test covers - removing it (but leaving the if LVRET .. branch there\, of course) gives no test failures ( inutile to say that it makes also \(1..2) return a list of references ..)
More expert advise appreciated.
Regards Adi
Fixed by change 19729.
@rgs - Status changed from 'new' to 'resolved'
Migrated from rt.perl.org#21624 (status was 'resolved')
Searchable as RT21624$