I searched the database and found a lot of information about sorting but unfortunately I could not quite wrap my brain around what I was seeing so decided to post
I have a text file that has names of books, number of pages, etc. The information is separated by colons (:). I could manually create sorted lists but what's the fun in that? I have not made any attempts that I can show, but I will list the code as it is, which deals with the formatted data being used in HTML output
my $file = 'books/bookLIST.txt'; open my $info, $file or die "Could not open $file: $!"; while(my $line = <$info>) { foreach ($line) { chop; @vlinks = split(/:/,$_) ; print "<tr><td><a href=\"bookDETAIL.cgi?book=$vlinks[1]\">$vli +nks[0]</a></td><td>$vlinks[2]</td><td>$vlinks[3]</a></td></tr>" } } # each line in the text file is as follows: # Title of Book:title_of_book:<number of pages>:Author's Name
I would like to be able to sort by vlinks[0], vlinks[2] or vlinks[3] but cannot figure where to sort and how. Any help would be appreciated.
In reply to Sorting Text File for HTML Output by michael.kitchen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |