I would do as Paladin suggested, put values into a hash. To print, I would declare an array with the correct order that you want and then use that array in the main loop of a generalized print routine. Of course you might want to think about what happens if for some reason some desired key didn't wind up existing.
#!/usr/bin/perl use strict; use warnings; $|=1; # generated from the if regex statements instead of printing # right away my %values = ( 'Luma Mode' => 'D45_PRED', 'Chroma Mode' => 'UV_CFL_PRED', 'CFL' => 5, 'Luma Angle' => 3, 'Chroma Angle' => 0, ); my @order = ('Luma Mode', 'Luma Angle', 'Chroma Mode', 'CFL', 'Chroma Angle'); foreach my $key (@order) { print "$key:\t $values{$key}\n"; } __END__ Luma Mode: D45_PRED Luma Angle: 3 Chroma Mode: UV_CFL_PRED CFL: 5 Chroma Angle: 0
Oh, I suppose that this code:
if ($line =~ /\s*APP>\sIntraAngleDelta\s:\s(\d+)\s(\d+)/i) { print "Luma Angle : $1\n" } if ($line =~ /\s*APP>\sIntraAngleDelta\s:\s(\d+)\s(\d+)/i) { print "Chroma Angle : $2\n" }
Should be this??:
if ($line =~ /\s*APP>\sIntraAngleDelta\s:\s(\d+)\s(\d+)/i) { $values{'Luma Angle'} = $1; $values{'Chroma Angle'} = $2; }

In reply to Re: Ordering of print statements by Marshall
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.