sub signatures coming

Paul Makepeace paulm at paulm.com
Tue Feb 25 03:45:32 GMT 2014


On Mon, Feb 24, 2014 at 2:04 PM, Steve Mynott <steve.mynott at gmail.com> wrote:
> http://perltricks.com/article/72/2014/2/24/Perl-levels-up-with-native-subroutine-signatures

Finally. But don't believe the python/perl comparison troll, as
python, for once, actually outguns perl on a character chomping basis,

sub pairwise_sum ($arg1, $arg2) {
    return map { $arg1->[$_] + $arg2->[$_] } 0 .. $#$arg1;
}

def pairwise_sum(list1, list2):
    return [i + j for i, j in zip(list1, list2)]

Paul


More information about the london.pm mailing list