> John,
> Could you please comment/explain the following lines please?
> >my @sorted = map { (split/\0/)[1] }
> >              sort
> >              map { "@{[(split)[1,0,2]]}\0$_" }
> >              @array;

It's fun trying to figure out what the heck John's code does :)

Split each element of @array on whitespace (/\s+/), re-order, and pass
right like so:

468X60  31472  1.49\031472  468X60  1.49
468X60  31473  2.18\031473  468X60  2.18
180X60  31488  1.39\031488  180X60  1.39
468X60  31476  1.58\031476  468X60  1.58
120X60  33472  2.49\033472  120X60  2.49
468X60  32473  4.38\032473  468X60  4.38

It then sorts the list so we have:

120X60  33472  2.49\033472  120X60  2.49
180X60  31488  1.39\031488  180X60  1.39
468X60  31472  1.49\031472  468X60  1.49
468X60  31473  2.18\031473  468X60  2.18
468X60  31476  1.58\031476  468X60  1.58
468X60  32473  4.38\032473  468X60  4.38

And then, finally, splits on \0 and takes the second part of that line,
which is the part ordered as the OP wanted it:

33472  120X60  2.49 
31488  180X60  1.39 
31472  468X60  1.49 
31473  468X60  2.18 
31476  468X60  1.58 
32473  468X60  4.38 

HTH,

 -dave



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to