Welcome, guest! Login Join

Login to Your Account

  |  » Forgot your password?


Perl help.

Tools Search
Join Date: January 18th, 2005
Posts: 1
Hi. Just a quick question. I'm fairly new to PERL and I just coded a small script I need for my site. Basically what it does is take input from a form and put it into a .txt file in this format;


(entry = what user input, count = how many times that input has been entered). It works fine but the problem is, it writes the file out in order of how the entrys are input.. I'd like it so the most requested entry is at the top, least requested at the bottom, such as..


etc.. can anyone help me with this?
Full Member
Join Date: January 18th, 2005
Posts: 480
A perl guru will probably have a better answer, but I suspect you are going to have open the file, read the entire file into an array, close the file handle, sort the array and then open the file for writing and print the array to the file. In effect you will be opening the file, getting all the data, erasing the file and writing a new file.

makin' money
Join Date: January 18th, 2005
Posts: 5
Text files are not they way to go when you need to do sorting. Start using a MySQL Database and your life will be much easier.
Join ABW to remove this sponsored message.

Tools Search

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump


Welcome to ABestWeb.com

Create your username to jump into the discussion!

ABestWeb.com is the largest affiliate marketing community on the Internet. Join us by filling in the form below.

(4 digit year)

Already a member?

Content Relevant URLs by vBSEO ©2011, Crawlability, Inc.