public
Created

Example of alias parameters as requested by Gabor in Perl Weekly

  • Download Gist
gistfile1.pl
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#! /usr/bin/env perl
 
use Modern::Perl;
use Method::Signatures;
 
 
func foo(\@bar, \@baz)
{
return map { $bar[$_] + $baz[$_] } 0..$#bar;
}
 
 
my @x = (2, 5, 8, 1);
my @y = (7, 3, 1, 6);
say join(', ', foo(\@x, \@y)); # 9, 8, 9, 7

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.