#!/usr/bin/perl

use Math::MatrixReal;

@trojkat = (Math::MatrixReal->new_from_string("[ -1 ]\n[ -1 ]\n"),
             Math::MatrixReal->new_from_string("[  0 ]\n[  1 ]\n"),
             Math::MatrixReal->new_from_string("[  1 ]\n[ -1 ]\n"));

$translacja = Math::MatrixReal->new_from_string("[ 1 ]\n[ 3 ]\n");

# Dodajemy macierz translacji 2 x 1 do wszystkich macierzy 2 x 1 w macierzy @trojkat.

foreach (@trojkat) { $_ += $translacja }

print @trojkat;
