I have a sorted array in a perl script eg:
qw(aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll)
Is there an easy way to display it in three columns so that
- first third is in left column
- middle third is in middle column
- and last third is in right column
This is so the elements can be displayed running down the screen instead of across it. eg
aaa eee iii
bbb fff jjj
ccc ggg kkk
ddd hhh lll
I have been trying to use modulus but it's getting complicated and thought there might be an elegant solution. Ultimately I intend to use it for something similar to select
in bash.
Thank you.