Hi, i am starter in perl and I am having some problems, in the moment. I would like to know how broke this list in a format of matrix, for example..
@list = 111111111111, whose have 12 elements in this format
1 1 1 1
1 1 1 1
1 1 1 1
with 3 lines and 4 columms.
thanks.
One possibility:
- use strict;
-
use warnings;
-
-
my @list = qw(1 1 1 1 1 1 1 1 1 1 1 1);
-
-
for (@list) {
-
for (1..4) {
-
print shift @list;
-
}
-
print "\n";
-
}
Of course it is very contrived to fit your exact requirements.