BEGIN { $/ = ">"; $\ = "\n"; }
  1. BEGIN: do what's inside the block (curly brackets) before getting involved with other parts of the script.
  2. $/ = ">";set the input record separator -- more or less, "use the greater_than symbol as a marker for the start of a new section to be read
  3. $\ = "\n"; set the output record separator to a newline (UNDERSTAND: these were provided by Deparse and are NOT explicitly set in the original one-liner.

In other words, more or less what you thought, "define the boundaries" of what your script will eventually see as a single-section's-worth-of-data. But, "<" is the less_than symbol, not a "carat" (nor "carrot" nor even what you probably intended, "caret").

... etcetera.

But most of the answers to your questions/guesses are available at your own terminal (or should be):

perldoc perlvar (special vars)
perldoc -f next
perldoc -f join

And you'll also find scads of help in the Tutorials section or by using Super Search or Dave Cross's specialized Perl Search (which, thanks to some rather neat hacks, outdoes big G when searching for punctuation-laden expressions).


In reply to Re^5: Perl script help to convert .txt file to .csv by ww
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.