(e.g. caused C<length("abc") % -10> to return 3 rather than -7)
p4raw-id: //depot/perl@4428
return o;
if (!(PL_hints & HINT_INTEGER)) {
- if (type == OP_DIVIDE || !(o->op_flags & OPf_KIDS))
+ if (type == OP_MODULO
+ || type == OP_DIVIDE
+ || !(o->op_flags & OPf_KIDS))
+ {
return o;
+ }
for (curop = ((UNOP*)o)->op_first; curop; curop = curop->op_sibling) {
if (curop->op_type == OP_CONST) {
#!./perl
-# $RCSfile: int.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:00 $
-
-print "1..4\n";
+print "1..6\n";
# compile time evaluation
$x = 1.234;
if (int($x) == 1) {print "ok 3\n";} else {print "not ok 3\n";}
if (int(-$x) == -1) {print "ok 4\n";} else {print "not ok 4\n";}
+
+$x = length("abc") % -10;
+print $x == -7 ? "ok 5\n" : "# expected -7, got $x\nnot ok 5\n";
+
+{
+ use integer;
+ $x = length("abc") % -10;
+ print $x == 3 ? "ok 6\n" : "# expected 3, got $x\nnot ok 6\n";
+}