B
Binny V A
Hello Everyone,
How do I sort the '@words' array to give it the value,
"One", "Two", etc. by using the '@numbers' array? I tried
to do so in the following way - but it won't work.
my @words = ( "Five","Ten","Seven","Two","Six","Nine","One","Eight","Three","Four"
);
my @numbers= ( "5","10","7","2","6","9","1","8","3","4" );
my $count = -1;
@words = sort { $count++; $numbers[$count] <=> $numbers[$count+1]; }
@words;
@numbers = sort { $a <=> $b } @numbers;
print "@numbers\n@words";
How do I do it?
Thanking You,
Binny V A
http://www.geocities.com/binnyva/code
How do I sort the '@words' array to give it the value,
"One", "Two", etc. by using the '@numbers' array? I tried
to do so in the following way - but it won't work.
my @words = ( "Five","Ten","Seven","Two","Six","Nine","One","Eight","Three","Four"
);
my @numbers= ( "5","10","7","2","6","9","1","8","3","4" );
my $count = -1;
@words = sort { $count++; $numbers[$count] <=> $numbers[$count+1]; }
@words;
@numbers = sort { $a <=> $b } @numbers;
print "@numbers\n@words";
How do I do it?
Thanking You,
Binny V A
http://www.geocities.com/binnyva/code