T
toplicanac
How to use string as two dimensional array
e.g.:
I have string
$string="123456abc";
-------------------------------------------
I want to read it like this
$mat(1,1) = "1"
$mat(2,1) = "2"
$mat(3,1) = "3"
$mat(1,2) = "4"
$mat(2,2) = "5"
$mat(3,2) = "6"
$mat(3,1) = "a"
$mat(3,2) = "b"
$mat(3,3) = "c"
But array can be 5x5, 10x10, or biger size.
What is easiest way to do it in Perl?
e.g.:
I have string
$string="123456abc";
-------------------------------------------
I want to read it like this
$mat(1,1) = "1"
$mat(2,1) = "2"
$mat(3,1) = "3"
$mat(1,2) = "4"
$mat(2,2) = "5"
$mat(3,2) = "6"
$mat(3,1) = "a"
$mat(3,2) = "b"
$mat(3,3) = "c"
But array can be 5x5, 10x10, or biger size.
What is easiest way to do it in Perl?