Permalink
Browse files

The context reverse() is called is irrelevant.

You always want to use the scalar behavior which reverses strings.
  • Loading branch information...
1 parent 3607bc5 commit 8d600b7149679c3b2ddd67d702bab68c5ebce9a7 @schwern schwern committed Sep 26, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/autobox/Core.pm
View
3 lib/autobox/Core.pm
@@ -777,7 +777,8 @@ sub length ($) { CORE::length($_[0]); }
sub ord ($) { CORE::ord($_[0]); }
sub pack ($;@) { CORE::pack(shift, @_); }
sub reverse ($) {
- wantarray ? return my $r = CORE::reverse($_[0]) : CORE::reverse($_[0]);
+ # Always reverse scalars as strings, never as a single element list.
+ return scalar CORE::reverse($_[0]);
}
sub rindex ($@) {

0 comments on commit 8d600b7

Please sign in to comment.