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

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

I have a data file with following lines:

gtssmpar11/dmunit1/mt_dm_fifo_csr_flopped_out/u_gt_ram/wrdataR_reg_0_b +171_b174_b236_b242_qreg/d2 19.33 18.65 -0.67 (VIOLATED) gtssmpar11/dmunit1/mt_dm_fifo_csr_flopped_out/u_gt_ram/wrdataR_reg_0_b +186_b196_b210_b223_qreg/d2 15.09 11.70 -3.39 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b103_b104/d2 40.35 36.61 -3.74 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b105_b106/d1 11.06 8.77 -2.29 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b105_b106/d1 40.08 29.18 -10.90 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b119_b120/d2 11.37 8.34 -3.03 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b11_b12/d2 14.56 4.41 -10.15 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b11_b12/d2 45.82 27.47 -18.34 (VIOLATED)

And I need to get the unique value and the smallest one for the fourth column with corresponding 1st column.

Output should be:

gtssmpar11/dmunit1/mt_dm_fifo_csr_flopped_out/u_gt_ram/wrdataR_reg_0_b +171_b174_b236_b242_qreg/d2 19.33 18.65 -0.67 (VIOLATED) gtssmpar11/dmunit1/mt_dm_fifo_csr_flopped_out/u_gt_ram/wrdataR_reg_0_b +186_b196_b210_b223_qreg/d2 15.09 11.70 -3.39 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b103_b104/d2 40.35 36.61 -3.74 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b105_b106/d1 40.08 29.18 -10.90 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b119_b120/d2 11.37 8.34 -3.03 (VIOLATED) gtssmpar21/flunit1/flunitx1/fl_flex1/fl_mt_input_fifo/u_gt_ram/wrdataR +_dreg_b11_b12/d2 45.82

I tried using pattern matching to get the column 1 and column 4 in hash and then sort the hash. But its not working the way i want. Please help.