From 35d0a7cd78d195c093d23cd0ca1515d109d3108f Mon Sep 17 00:00:00 2001 From: brian d foy Date: Sun, 12 Feb 2023 00:27:23 -0500 Subject: [PATCH] bc reversed the array index and value Co-authored-by: Michael Mikonos --- bin/bc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/bc b/bin/bc index b415cd46..7c0989aa 100755 --- a/bin/bc +++ b/bin/bc @@ -1722,7 +1722,10 @@ $count++; } elsif($_ eq 'P') { - push(@ope_stack, $instr->[1].'[]'.(pop(@ope_stack))); + my $value = pop @ope_stack; + my $index = pop @ope_stack; + push @ope_stack, $value; + push @ope_stack, $instr->[1] . '[]' . $index; next INSTR; } elsif($_ eq 'v') {