I can't tell, whether my correction will give you the desired result - NO - I'm SURE they won't - but maybe it gives you an idea where you lack knowledge.
open(STDIN1, "<icd_meas_child.txt") # --NO-- or die "Cannot open file"; or die "Cannot open icd_meas_child.txt: $!\n"; # Don't leave people unsure about which file and what +reason ($!) @row1 = <STDIN1>; # What do you think you're doing here? # for (@row1[$done1]) # try foreach (@row) { # OUCH! Don't chop if you want to chomp! # chop(@row1); chomp; # And what do you think will this do? # foreach (@row1[$count1]) # { # @column1 = split(/\,/,@row1[$count1]); # $sat_name = @column1[0]; # $meas_name = @column1[1]; # $parent_meas = @column1[2]; # $start_bit_no = @column1[3]; ($sat_name, $meas_name, $parent_meas, $start_bit_no +)= split /,/; print ("$sat_name;"); print ("$meas_name;"); &DESCRIPTION; # <---- What do these do? &DATA; # <--/ print ("$size_bits_no;"); &DATA1; # ??? print ("$monitor_type;"); print ("$parent_meas;"); &BIT; print ("$start_bit_no;"); &SUBSYSTEM; # ??? &BOX; # ??? print ("$lsb_proc_ind;"); print ("$blank"); print ("\n"); $count1++; # } $done1++; } close STDIN1; sub BIT #routine to sort numbers { # OUCH! You know what you do??? # if ($meas_name = $parent_meas) # I think you meant if ($meas_name == $parent_meas) { # I won't even try to imagine what this line WILL do # my @nums = $start_bit_no; # I think it SHOULD do push(@nums, $start_bit_no); # So pushing the start bit to a global array my @index= sort { $nums[$a-1] <=> $nums[$b-1] } 1..@nums; # Fortunately you mad the following line a comment by a typo ;-) #$index++; # But here OUCH again #print join "\n","@index;",''; # Are you sure you didn't mean: print join("\n",@index),"\n"; } } __END__ A1,BL1CHILDB0,BL1PARENTMON,0 A1,BL1CHILDB1,BL1PARENTMON,1 A1,BL1CHILDB2,BL1PARENTMON,2 A1,BL1CHILDB3,BL1PARENTMON,3 A1,BL1CHILDB4,BL1PARENTMON,4 A1,BL2CHILDB5,BL1PARENTMON,5 A1,BL2CHILDB6,BL1PARENTMON,6 A1,BL2CHILDB7,BL1PARENTMON,7 A1,BL2CHILDB3,BL2PARENTMON,1 A1,BL2CHILDB6,BL2PARENTMON,0 A1,D1CHILDB0,D1PARENTMON,0 A1,D2CHILDB1T3,D1PARENTMON,1 A1,D3CHILDB4T5,D1PARENTMON,4 A1,D4CHILDB6,D1PARENTMON,6 A1,D5CHILDB7,D1PARENTMON,7

In reply to Re: (5) Sorting numbers (not) by Skeeve
in thread Sorting numbers by Anonymous Monk

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.