I have a txt file that I am trying to parse into variables.... Line 1 = 0154.45 +02 13.56 +03 64.35 Line 2 = +09 23.12 +10 8798 I have written a regular expression to parse out the first line, but how do I continue the regular expression onto the 2nd line to extract variables...ie $1 thru $5 Here is the input file: B A1 L+44941 C0747 *D 01+0100. 02+2014. 03+0111. 04+1820. 05+13.14 06+344.1 07+62.83 08+1017. 09+16.56 10+1811. A1 L+44951 C5311 * And my partial code open(FH, "<$file"); @array = <FH>; close FH; open(OUT,'>','outfile.txt'); @array1 = @array3..$#array-4; print OUT @array1; close OUT; open (FILE, "/test/outfile.txt"); while (<FILE>) { print; ~ /^.*(0-90-90-9)..*(0-90-90-90-9)..*(0-90-90-9)..*(0-90-90-90-9)..*(0-90-9.0-90-9) .*(0-90-90-9.0-9) .*(0-90-9.0-9).*(0-90-90-90-9)/s; $id = $1; $year4 = $2; $doy = $3 ; $time = $4; $speed = $5; $ddir = $6; $temp = $7; $baro = $8; $windgust = $9; $gusttime = $10;

In reply to Regular Expression ? by dak1611

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.