ajout de 2 listes dans une liste

Creation: 18 mai 2013
Mise à jour:
Version: 1.0
Author: Jean-Louis Bicquelet-Salaün
Location: http://jlbicquelet.free.fr
Copyright: (c) 2013 Jean-Louis BICQUELET-SALAÜN
array_add  

  array

 

19/05/2013  

array_add

retourne un tableau composé des éléments de deux autres tableau

exemple:


fonction

sub array_add { my ($ref1, $ref2) = @_; while (@{$ref1}) { unshift @result, pop(@{$ref1}) + pop(@{$ref2}); } return @result; }

exemple

@a = (1, 2, 3);
@b = (4, 5, 6);
@c = add_array(\@a, \@b);
print @c;

print @array;

see also