texuser74 has asked for the wisdom of the Perl Monks concerning the following question:
Dear Perl Monks,
I have an input file with numbers seperated in <sep> tags. i want the sorting to happen only inside those tags.
e.g.
input
output should be like<sep> 22 1 3 <sep> 4 2 44
<sep> 1 3 22 <sep> 2 4 44
my following scripts sorts but not with in the sep tags.
open(IN, "<sort.in") || die "\nCan't open ap3.07 \n"; open(OUT, ">sort.out"); @array=<IN>; close (IN); @sortedarray=sort {$a <=> $b} (@array); foreach $line (@sortedarray){ print OUT $line; } close(IN); close(OUT);
pls help me in doing this
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: sorting inside specific
by Limbic~Region (Chancellor) on Sep 10, 2004 at 13:29 UTC | |
Re: sorting inside specific
by Arunbear (Prior) on Sep 10, 2004 at 13:54 UTC | |
Re: sorting inside specific
by svsingh (Priest) on Sep 10, 2004 at 13:35 UTC | |
Re: sorting inside specific
by Random_Walk (Prior) on Sep 10, 2004 at 13:30 UTC | |
Re: sorting inside specific
by mutated (Monk) on Sep 10, 2004 at 13:25 UTC | |
by Limbic~Region (Chancellor) on Sep 10, 2004 at 13:37 UTC | |
by mutated (Monk) on Sep 10, 2004 at 13:49 UTC | |
by Limbic~Region (Chancellor) on Sep 10, 2004 at 13:52 UTC | |
by mutated (Monk) on Sep 10, 2004 at 14:00 UTC | |
by jryan (Vicar) on Sep 10, 2004 at 19:37 UTC |
Back to
Seekers of Perl Wisdom