Hi. I'm makng a couple of assumptions, please ignore this post if I'm wrong:

(Update: added OP's <DATA> to make my code stand alone.)

1) The <DATA> snippet that your provided is what you parsed to get your %channel_db_files data structure.

2) 'File numbers' are unique, as in the data you provided.

In which case, I would suggest that you parse your data differently:

my @ordered; while ( <DATA> ) { $ordered[$1] = $2 if /input datafile file number=(\d+) name=(\S+)/ } print "$_\t$ordered[$_]\n" for 1 .. $#ordered; __DATA__ Starting backup at 2011-05-31 02:00:05 channel ch1: starting compressed full datafile backup set channel ch1: specifying datafile(s) in backup set input datafile file number=00010 name=/foo/oradata/bar/foodb-lob01.dbf input datafile file number=00004 name=/foo/oradata/bar/foodb-data02.db +f input datafile file number=00007 name=/foo/oradata/bar/undotbs02.dbf channel ch1: starting piece 1 at 2011-05-31 02:00:06 channel ch2: starting compressed full datafile backup set channel ch2: specifying datafile(s) in backup set input datafile file number=00003 name=/foo/oradata/bar/tools01.dbf input datafile file number=00006 name=/foo/oradata/bar/foodb-index11.d +bf input datafile file number=00002 name=/foo/oradata/bar/undotbs01.dbf channel ch2: starting piece 1 at 2011-05-31 02:00:06 channel ch3: starting compressed full datafile backup set channel ch3: specifying datafile(s) in backup set input datafile file number=00008 name=/foo/oradata/bar/foodb-data01.db +f input datafile file number=00009 name=/foo/oradata/bar/foodb-index01.d +bf input datafile file number=00005 name=/foo/oradata/bar/xml01.dbf input datafile file number=00001 name=/foo/oradata/bar/system01.dbf channel ch3: starting piece 1 at 2011-05-31 02:00:07 channel ch1: finished piece 1 at 2011-05-31 02:34:54 #----------------8<----------------

Ouput:

1 /foo/oradata/bar/system01.dbf 2 /foo/oradata/bar/undotbs01.dbf 3 /foo/oradata/bar/tools01.dbf 4 /foo/oradata/bar/foodb-data02.dbf 5 /foo/oradata/bar/xml01.dbf 6 /foo/oradata/bar/foodb-index11.dbf 7 /foo/oradata/bar/undotbs02.dbf 8 /foo/oradata/bar/foodb-data01.dbf 9 /foo/oradata/bar/foodb-index01.dbf 10 /foo/oradata/bar/foodb-lob01.dbf

In reply to Re: How-to sort nested hash table? by Not_a_Number
in thread How-to sort nested hash table? by Scottie

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.