The example can, but as soon as you have numbers that are a different order of magnitude, it will fail:
print sort <DATA>;
__DATA__
9|microsoft
70|aol
108|netscape
35|mozilla
40|opera
Based on the similarity of this example, with that in Need help with searching flatfile and updating it., I can only assume that the numbers aren't going to remain static. | [reply] [Watch: Dir/Any] [d/l] |
print sort { $a <=> $b } <DATA>;
__DATA__
9|microsoft
70|aol
108|netscape
35|mozilla
40|opera
The main issue here is what you want to do with the data at the end, since you're printing it in the same format as it started with, then you don't need to split it only to join it back at the end since sort will work either way.
He who asks will be a fool for five minutes, but he who doesn't ask will
remain a fool for life.
Chady | http://chady.net/
| [reply] [Watch: Dir/Any] [d/l] |