One column of what?
Fourteen rows of what?
Split what in half?
Are you trying to rearrange a table?
If so how should the items in the table be rearranged?
Your Possible
Table Results
----- ----- -----
A A B A H
B C D B I
C E F C J
D G H D K
E I J E L
F K L F M
G M N G N
H
I
J
K
L
M
N
Here's some perl code that prints out simple tables from an array.
use strict;
use warnings;
my @stuff = 1..14;
# Print 14 rows in one column.
print "\n\n14 Rows\n";
print join "\n", @stuff;
# Print 7 rows two columns
print "\n\n7 Rows One Way\n";
print map { "$stuff[2*$_]\t$stuff[2*$_+1]\n" } 0..$#stuff/2;
print "\n\n7 Rows Another Way\n";
print map { "$stuff[$_]\t$stuff[$#stuff/2+$_+1]\n" } 0..$#stuff/2;
You won't be able to write a program in any language unless you can clearly describe what you want to do in any suitable human language (such as English).
Start your program by writing comments:
# Open a text file
# Read the file
# Print file contents out like this
# LINE_1 LINE_2
# LINE_3 LINE_4
Then start filling in the Perl between the comments.
If you get stuck, try posting a clear question with your code so far, and you'll have much better luck.
Happy hacking. When I was starting out, I found How to RTFM to be a very useful post. Note that perldoc.com is long gone, so use http://perldoc.perl.org to find perldoc on the web.
|