I'm not sure if this is exactly what you want, I may have mis-understood, but here is my stab at it:
use warnings; use strict; local $/ = ""; # Paragraph mode # Capture the header from the top of the file # not sure what you want doing with this though! my $header = <DATA>; chomp $header; print "Header: <$header>\n\n"; # Now process the other records while (<DATA>) { chomp; my @lines = split("\n"); # extract header my $head = shift @lines; # Append header as an end column for (@lines) { $_ .= $head } # Display result local $, = "\n"; print @lines,"\n"; } __DATA__ FUNCTION VCC= 4.50V, VIL=0V, VIH=3V, VOL=VOH=1.5V PASS 4 730 0 FUNCTION VCC= 5.50V, VIL=0V, VIH=3V, VOL=VOH=1.5V PASS VOL TEST @VCC= 4.5V, VIL=2V, VIH=5.5V 5 796 6 421.5 mV,RNG1 60.00 mA,M100 + 5 801 381.5 m 0 500.0 m + 5 815 8 417.0 mV,RNG1 60.00 mA,M100 + 5 820 377.0 m 0 500.0 m + VOH1 TEST @VCC=4.5V, VIL=0.8V, VIH=5.5V 6 886 6 2.920 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V + 6 899 6 2.920 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V + 6 912 6 2.916 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V + 6 925 6 2.916 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V + 6 938 8 2.920 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V
Gives: (note that lines are wrapped around +)
Header: <FUNCTION VCC= 4.50V, VIL=0V, VIH=3V, VOL=VOH=1.5V PASS 4 730 0 FUNCTION VCC= 5.50V, VIL=0V, VIH=3V, VOL=VOH=1.5V PASS > 5 796 6 421.5 mV,RNG1 60.00 mA,M100 + VOL TEST @VCC= 4.5V, VIL=2V, VIH=5.5V 5 801 381.5 m 0 500.0 m + VOL TEST @VCC= 4.5V, VIL=2V, VIH=5.5V 5 815 8 417.0 mV,RNG1 60.00 mA,M100 + VOL TEST @VCC= 4.5V, VIL=2V, VIH=5.5V 5 820 377.0 m 0 500.0 m + VOL TEST @VCC= 4.5V, VIL=2V, VIH=5.5V 6 886 6 2.920 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V + VOH1 TEST @VCC=4.5V, VIL=0.8V, VIH=5.5V 6 899 6 2.920 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V + VOH1 TEST @VCC=4.5V, VIL=0.8V, VIH=5.5V 6 912 6 2.916 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V + VOH1 TEST @VCC=4.5V, VIL=0.8V, VIH=5.5V 6 925 6 2.916 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V + VOH1 TEST @VCC=4.5V, VIL=0.8V, VIH=5.5V 6 938 8 2.920 V,RNG2 -3.015 mA,M100 2.500 V 4.500 V + VOH1 TEST @VCC=4.5V, VIL=0.8V, VIH=5.5V

In reply to Re: Copy line into new column by cdarke
in thread Copy line into new column by softserve

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.