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.


TGI says moo


In reply to Re: splitting one column into two by TGI
in thread splitting one column into two by lunabelle22a

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.