Advertisement

06.08.2008 at 11:24PM PDT, ID: 23468160
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

Sorting text file column separated by a TAB in Perl

Asked by sprockston in Perl Programming Language

Tags:

Hello.
I processed a lot of data in Perl, and now I need to sort it.

My data is in a text file called data.txt:
NLLHETDSA       981.03
TQIPHLAGT       919.04
ETDSAVATA       845.86
LCAGALVLA       812.04
HETDSAVAT       911.92
SAVATARRP       910.05
SSNEATNIT       917.92
GTEQNFQLA       989.05
AVATARRPR       979.16
NEATNITPK       969.05
RWLCAGALV       947.2
IKSSNEATN       944.99
QIPHLAGTE       947.06
GALVLAGGF       785.94
SNEATNITP       927.96
DSAVATARR       928.02
LHETDSAVA       923.98
CAGALVLAG       755.93
EATNITPKH       992.09
PHLAGTEQN       948.0
GGFFLLGFL       952.17
LAGTEQNFQ       989.05
ATNITPKHN       977.07
LAGGFFLLG       876.07
AGALVLAGG       709.84
IPHLAGTEQ       947.06
FTQIPHLAG       965.12
RPRWLCAGA       988.22

It is basically a 9 character string followed by a tab (\t), and then an integer value. I wish to sort the list in ascending order from the integer values, so it will look similar to:
AGALVLAGG       709.84
CAGALVLAG       755.93
GALVLAGGF       785.94
LCAGALVLA       812.04
ETDSAVATA       845.86
LAGGFFLLG       876.07
...

How can I do this in Perl? I am aware that this is very easy in awk or shell scripting, but I need to have this contained within my Perl program.

Thanks in advance. :)
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
Data:
 
NLLHETDSA       981.03
TQIPHLAGT       919.04
ETDSAVATA       845.86
LCAGALVLA       812.04
HETDSAVAT       911.92
SAVATARRP       910.05
SSNEATNIT       917.92
GTEQNFQLA       989.05
AVATARRPR       979.16
NEATNITPK       969.05
RWLCAGALV       947.2
IKSSNEATN       944.99
QIPHLAGTE       947.06
GALVLAGGF       785.94
SNEATNITP       927.96
DSAVATARR       928.02
LHETDSAVA       923.98
CAGALVLAG       755.93
EATNITPKH       992.09
PHLAGTEQN       948.0
GGFFLLGFL       952.17
LAGTEQNFQ       989.05
ATNITPKHN       977.07
LAGGFFLLG       876.07
AGALVLAGG       709.84
IPHLAGTEQ       947.06
FTQIPHLAG       965.12
RPRWLCAGA       988.22
 
Loading Advertisement...
 
[+][-]06.08.2008 at 11:46PM PDT, ID: 21741354

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 12:04AM PDT, ID: 21741405

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 12:27AM PDT, ID: 21741476

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 03:31AM PDT, ID: 21742063

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 03:50AM PDT, ID: 21742144

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 09:45AM PDT, ID: 21744598

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 10:50AM PDT, ID: 21745066

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 11:04AM PDT, ID: 21745169

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: Perl
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.09.2008 at 11:04AM PDT, ID: 21745171

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 11:13AM PDT, ID: 21745243

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628