Continued from before...Now I'm trying to understand the parsed version

BEGIN { $/ = ">"; $\ = "\n"; }

Not sure, but does this statement define the boundaries of each line? Start with a carat and end with a new line.

LINE: while (defined($_ = <ARGV>)) { chomp $_;

Setting up the while loop, what does $_ = <ARGV> mean?

our(@F) = split(' ', $_, 0); next unless @F;

This sets the array F and splits it at each whitespace, and two other terms I dont know. What does next unless @F mean?

s/length=// foreach ($F[1]);

This code clears the length= string from every first column in the array.

@F[5] = join('', @F[5..99]);

This joins any columns past 5-99 with column 5

$#F = 5;

Don't know? Does this turn the array into a scalar variable set to 5 columns?

print '>', join(',', @F);

This is the print statement, printing the carat. Then you join each column of the array by a comma?


In reply to Re^4: Perl script help to convert .txt file to .csv by Seabass
in thread Perl script help to convert .txt file to .csv by Seabass

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.