If all the lines are in an array, you could use grep to find each line. Arrange the tests in the order that you want the output.
C:\Users\Bill\forums\monks>type eshan_k.pl use strict; use warnings; my @text = do{undef $/; <DATA>}; my $line; ($line) = grep {/LumaIntraMode/} @text; if ($line =~ /\s*APP>\s*LumaIntraMode\s:(\w+),\suse_intrabc:(\d)/i) { print "Luma_mode = $1\n"; } ($line) = grep {/\sAPP\>\sIntraAngleDelta\s\:\s/} @text; if ($line =~ /\s*APP>\sIntraAngleDelta\s:\s(\d+)\s(\d+)/i) { print "Luma Angle : $1\n" } ($line) = grep {/ChromaIntraMode/} @text; if ($line =~ /\s*APP>\s*ChromaIntraMode\s\:(\w+)/i) { print "Chroma mode: $1\n"; } ($line) = grep {/ALPHA_U\:/} @text; if ($line =~ /\s*ALPHA_U: (\d+), ALPHA_V: (\d+), CFL_ALPHA_SIGN: (\d+) +/i) { print "CFL : $3\n"; } ($line) = grep {/\sAPP\>\sIntraAngleDelta\s\:\s/} @text; if ($line =~ /\s*APP>\sIntraAngleDelta\s:\s(\d+)\s(\d+)/i) { print "Chroma Angle : $2\n" } __DATA__ APP> LumaIntraMode :D45_PRED, use_intrabc:0 AED> Dif: 80369151, Rng: 34624, Cnt: 10, Ret: 6 AED> Dif: 642953215, Rng: 52408, Cnt: 7, Ret: 13 APP> ChromaIntraMode :UV_CFL_PRED AED> Dif: 22413311, Rng: 36032, Cnt: 2, Ret: 5 AED> Dif: 115632447, Rng: 63232, Cnt: 11, Ret: 3 APP> ALPHA_U: 48, ALPHA_V: 0, CFL_ALPHA_SIGN: 5, CFL_ALPHA_IDX: 48 APP> IntraAngleDelta : 3 0 C:\Users\Bill\forums\monks>perl eshan_k.pl Luma_mode = D45_PRED Luma Angle : 3 Chroma mode: UV_CFL_PRED CFL : 5 Chroma Angle : 0

Note: Minor corrections to several of the regexes and to the order of the tests.

Bill

In reply to Re: Ordering of print statements by BillKSmith
in thread Ordering of print statements by Eshan_k

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.