in reply to Re^2: string diff and comparein thread string diff and compare
my ( $rold, $rnew ) = map scalar reverse, $old, $new;
Is just a different way of saying:
my $rold = reverse $old;
my $rnew = reverse $new;
You need to use scalar because reverse is in list context in the map expression.
There are other ways of enforcing scalar context which are a lot more fun. :-)
use 5.010; use strict; use warnings all => 'FATAL';
my ( $old, $new ) = qw( old new );
my ( $rold, $rnew ) = map~~reverse, $old, $new;
"$old => $rold",
"$new => $rnew";
Results (313 votes). Check out past polls.