Anish has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl open (input, "<SAPPDAY.00063"); open (out, ">SAPPDAY.00063out"); #!/usr/bin/perl #!/usr/bin/perl #!/usr/bin/perl open (IN, "<temp65") or die "couldn't open file for reading"; open (OUT, ">temp95")or die "couldn't open file for writing"; @EDI=<IN>; #$number=$#EDI; close (IN); #$Id=substr($EDI[0],6,5); #print $Id; #print $number; @temp=map{[substr($_,6,5),$_ ]} @EDI; @temp= sort {$a->[0] cmp $b->[0]} @temp; @ordered=map {$_->[1]} @temp; $count=1; #$ele=$#ordered; #print "$ele\n"; for $x (0..$#ordered){ #$num=substr($ordered[$x],3,3); #print "$num is right\n"; $ordered[x]=~s/(substr($ordered[$x],3,3))/$count/; $count++; } print OUT @ordered; close (OUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sort and Substitution
by Fastolfe (Vicar) on Oct 24, 2000 at 22:58 UTC | |
|
Re: Sort and Substitution
by runrig (Abbot) on Oct 24, 2000 at 22:58 UTC | |
|
RE: Sort and Substitution
by extremely (Priest) on Oct 25, 2000 at 11:09 UTC | |
|
Re: Sort and Substitution
by snowcrash (Friar) on Oct 25, 2000 at 12:18 UTC |