So this is strange, when i run this code on the file on its own away from what i am trying to do.
#!/usr/bin/perl my $file = shift; open (LOG, "<$file"); my $tag1 = "11=Order53:1:1140693468"; @logarray=<LOG>; foreach(@logarray){ if(($_=~ m/35=8/)&&($_ =~ m/$tag1/)){ printf ("$_\n"); } }
I get the result i am looking for all be it away from what i am trying to do.
$ perl t.pl fix.log 8=FIX.4.29=034435=849=EXLINK_COMPLEX56=COMPLEX_EXLINK50=COMPLEXGATE57= +DBL9991134=552=20060223-11:18:3 31=L6096=0.000011=Order53:1:114069346814=0.000017=1118339840020=031=0. +0000000032=0.000037=132710014138=1.000039=054=155=Tester60=20060223-1 +1:18:33150=0151=1.0000109=Test23=0167=FUT200=200603207=Test 40=144=0.0000000010=026 $

But in my main code , all i do is call this routine and ask it to search for the file for the same entries as above, and return the results.

sub readfile() { my($tag1,$tag2) = @_; open(FF, "<$fixmessageloc") || die ("Unable to open file: $!: readfil +e_rt \n"); my @logarray = <FF>; if($debug){&writelog(1,"DEBUG: Entered into readfile_rt: passed ($tag +1)($tag2)");} foreach(@logarray){ if(($_ =~ m/35=8/)&&($_ =~ m/$tag1/)){ if(($debug)&&($datadumperdebug)){&writelog(1,"DEBUG: readfile_rt: + found string $_");} printf "Found = $_\n"; } }
But that returns loads of rows and not one row, and some of them don't even match

In reply to Re^3: File lines being treated as one. by minixman
in thread File lines being treated as one. by minixman

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.