in reply to adding n-tuples
When hacking this on my mobile I hoped using a "magic" solution might need less keystrokes.
use strict; use warnings; $\ = "\n"; my @a = map {int rand 10} 0..3; my @b = map {int rand 10} 0..3; print "IN: (@a) (@b)"; print eval join '+' , glob join '\*' , map "{$a[$_],$b[$_]}", 0..3; __END__ perl mult_tuple.pl IN: (9 8 8 9) (3 1 7 3) 19440
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
|---|