in reply to Sorting Issue
use strict; use warnings; { local $/; printInTwos( sort {$a <=> $b} split m{(?:,|\s+)}, <DATA>); } sub printInTwos { print(shift, q{,}, shift, qq{\n}) while @_; } __END__ 10,20 30,10 20,70 70,80 40,90 90,100 50,50
The output is
10,10 20,20 30,40 50,50 70,70 80,90 90,100
Cheers,
JohnGG
Update: I've just re-read the OP and realised I totaly misunderstood the requirement. Please ignore this post.
|
|---|