http://www.perlmonks.org?node_id=604945

rsriram has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

This is another question relating to the content, which I seeked help before. I have a text file, which has less than 100 lines and I need to sort this based on the second column.

77876 8543 CA84985 54E 77873 8003 CA84985 54E 77875 7725 CA84985 54E 77872 8511 CA84985 54E 77873 8123 CA84985 54E 77822 9908 CA84985 54E 77819 8503 CA84985 54E 77826 8040 CA84985 54E 77822 7874 CA84985 54E 77884 8543 CA84985 54E 77809 7211 CA84985 54E

I can add each line to a array and sort it, but it is sorting only based on the first column. Can anyone help me?

The output needs to look similar to this

77809 7211 CA84985 54E 77875 7725 CA84985 54E 77822 7874 CA84985 54E 77873 8003 CA84985 54E 77826 8040 CA84985 54E 77873 8123 CA84985 54E 77819 8503 CA84985 54E 77872 8511 CA84985 54E 77876 8543 CA84985 54E 77884 8543 CA84985 54E 77822 9908 CA84985 54E