in reply to
Re^2: string diff and compare
in 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";
By rote learning.
Via Genetic memory.
It's provided by my firmware.
I just remember them.
Thirty days hath September
My computer gets it right, usually.
I just ask someone else.
Someone punches me on the first of the month.
Results (50 votes),