in reply to creating a matrix
You want an array of arrays - see perldsc :
use strict; use warnings; # not use warngings; my $aoa = []; ## 4 x 4 matrix for my $x ( 0 .. 3 ){ for my $y ( 0.. 3){ $aoa->[$x]->[$y] = "this is a cell!"; } } [download]
HTH!